From e4c51396c80ae25da2e48daae881c034d5e092f5 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 24 Nov 2015 18:49:21 +0300 Subject: [PATCH] Add. option to work with broken `affected_rows` FS 1.4 --- resources/install/scripts/fax_queue/tasks.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/resources/install/scripts/fax_queue/tasks.lua b/resources/install/scripts/fax_queue/tasks.lua index 2605d6e237..b3827a9051 100644 --- a/resources/install/scripts/fax_queue/tasks.lua +++ b/resources/install/scripts/fax_queue/tasks.lua @@ -19,6 +19,14 @@ else error("unsupported database type: " .. database.type) end +-- Broken on FS 1.4 with native postgresql +-- Fixed on 1.6.0 +-- Also works with ODBC +local ignore_affected_rows = true +if dbh_affected_rows_broken ~= nil then + ignore_affected_rows = dbh_affected_rows_broken +end + local Q850_TIMEOUT = { [17] = 60; } @@ -110,7 +118,11 @@ local function next_task() if not task then return nil, err end local ok, err = db:query( aquire_task_sql:format(task.uuid) ) if not ok then return nil, err end - if db:affected_rows() == 1 then + local rows = db:affected_rows() + if ignore_affected_rows then + rows = 1 + end + if rows == 1 then task.no_answer_counter = tonumber(task.no_answer_counter) task.no_answer_retry_counter = tonumber(task.no_answer_retry_counter) task.retry_counter = tonumber(task.retry_counter)