[asterisk-commits] tilghman: branch 1.6.0 r137160 - in /branches/1.6.0: ./ res/res_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Aug 10 19:27:47 CDT 2008


Author: tilghman
Date: Sun Aug 10 19:27:46 2008
New Revision: 137160

URL: http://svn.digium.com/view/asterisk?view=rev&rev=137160
Log:
Merged revisions 137150 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r137150 | tilghman | 2008-08-10 19:25:28 -0500 (Sun, 10 Aug 2008) | 13 lines

Merged revisions 137138 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r137138 | tilghman | 2008-08-10 19:20:38 -0500 (Sun, 10 Aug 2008) | 5 lines

Deallocate database connection handle on disconnect, as we allocate another
one on connect.
(closes issue #13271)
 Reported by: dveiga

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/res/res_odbc.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_odbc.c?view=diff&rev=137160&r1=137159&r2=137160
==============================================================================
--- branches/1.6.0/res/res_odbc.c (original)
+++ branches/1.6.0/res/res_odbc.c Sun Aug 10 19:27:46 2008
@@ -533,16 +533,27 @@
 static odbc_status odbc_obj_disconnect(struct odbc_obj *obj)
 {
 	int res;
+	SQLINTEGER err;
+	short int mlen;
+	unsigned char msg[200], stat[10];
+
 	ast_mutex_lock(&obj->lock);
 
 	res = SQLDisconnect(obj->con);
 
 	if (res == ODBC_SUCCESS) {
-		ast_log(LOG_WARNING, "res_odbc: disconnected %d from %s [%s]\n", res, obj->parent->name, obj->parent->dsn);
+		ast_log(LOG_DEBUG, "Disconnected %d from %s [%s]\n", res, obj->parent->name, obj->parent->dsn);
 	} else {
-		ast_log(LOG_WARNING, "res_odbc: %s [%s] already disconnected\n",
-		obj->parent->name, obj->parent->dsn);
-	}
+		ast_log(LOG_DEBUG, "res_odbc: %s [%s] already disconnected\n", obj->parent->name, obj->parent->dsn);
+	}
+
+	if ((res = SQLFreeHandle(SQL_HANDLE_DBC, obj->con) == ODBC_SUCCESS)) {
+		ast_log(LOG_DEBUG, "Database handle deallocated\n");
+	} else {
+		SQLGetDiagRec(SQL_HANDLE_DBC, obj->con, 1, stat, &err, msg, 100, &mlen);
+		ast_log(LOG_WARNING, "Unable to deallocate database handle? %d errno=%d %s\n", res, (int)err, msg);
+	}
+
 	obj->up = 0;
 	ast_mutex_unlock(&obj->lock);
 	return ODBC_SUCCESS;




More information about the asterisk-commits mailing list