[asterisk-commits] tilghman: branch 1.4 r66919 -
/branches/1.4/funcs/func_odbc.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Jun 1 14:45:46 MST 2007
Author: tilghman
Date: Fri Jun 1 16:45:44 2007
New Revision: 66919
URL: http://svn.digium.com/view/asterisk?view=rev&rev=66919
Log:
On some drivers, deallocating the statement handle isn't enough. We also have to clear the cursor (nice, Oracle)
Modified:
branches/1.4/funcs/func_odbc.c
Modified: branches/1.4/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/funcs/func_odbc.c?view=diff&rev=66919&r1=66918&r2=66919
==============================================================================
--- branches/1.4/funcs/func_odbc.c (original)
+++ branches/1.4/funcs/func_odbc.c Fri Jun 1 16:45:44 2007
@@ -82,6 +82,7 @@
res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
+ SQLCloseCursor(stmt);
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
return NULL;
}
@@ -184,8 +185,10 @@
snprintf(varname, sizeof(varname), "%d", (int)rows);
pbx_builtin_setvar_helper(chan, "ODBCROWS", varname);
- if (stmt)
+ if (stmt) {
+ SQLCloseCursor(stmt);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ }
if (obj)
ast_odbc_release_obj(obj);
@@ -255,6 +258,7 @@
res = SQLNumResultCols(stmt, &colcount);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Column Count error!\n[%s]\n\n", sql);
+ SQLCloseCursor(stmt);
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
return -1;
@@ -273,6 +277,7 @@
} else if (option_verbose > 3) {
ast_log(LOG_WARNING, "Error %d in FETCH [%s]\n", res, sql);
}
+ SQLCloseCursor(stmt);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
return res1;
@@ -291,6 +296,7 @@
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
+ SQLCloseCursor(stmt);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
return -1;
@@ -316,6 +322,7 @@
/* Trim trailing comma */
buf[buflen - 1] = '\0';
+ SQLCloseCursor(stmt);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
return 0;
More information about the asterisk-commits
mailing list