summaryrefslogtreecommitdiff
path: root/res/res_odbc.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-08-11 00:25:28 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-08-11 00:25:28 +0000
commit37133a6993d57f43c584521db5c202863d941eff (patch)
tree488e899034f27d1adb2a5edd5c56f0e9c7dc099e /res/res_odbc.c
parent7a636521b16f193c5966ff8d25d205d831b77f0b (diff)
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 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137150 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_odbc.c')
-rw-r--r--res/res_odbc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c
index 9746c7330..7a5d7b3dc 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -754,16 +754,27 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
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;