]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Need to retrieve the rows affected before using the associated variable.
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 15 Feb 2011 07:01:37 +0000 (07:01 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 15 Feb 2011 07:01:37 +0000 (07:01 +0000)
(closes issue #18795)
 Reported by: irroot
 Patches:
       20110211__issue18795.diff.txt uploaded by tilghman (license 14)
 Tested by: tilghman

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@307836 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_odbc.c

index 123d55abf10e62d480239dff2a3723d4857e7ce8..b824827339a9e715974c3aadc08ae41862b80cd6 100644 (file)
@@ -325,6 +325,10 @@ static int acf_odbc_write(struct ast_channel *chan, const char *cmd, char *s, co
                }
        }
 
+       if (stmt) {
+               SQLRowCount(stmt, &rows);
+       }
+
        if (stmt && rows == 0 && ast_str_strlen(insertbuf) != 0) {
                SQLCloseCursor(stmt);
                SQLFreeHandle(SQL_HANDLE_STMT, stmt);
@@ -347,7 +351,6 @@ static int acf_odbc_write(struct ast_channel *chan, const char *cmd, char *s, co
                }
        } else if (stmt) {
                status = "SUCCESS";
-               SQLRowCount(stmt, &rows);
        }
 
        AST_RWLIST_UNLOCK(&queries);