<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][15677] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=15677">15677</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2009-11-25 18:07:24 -0600 (Wed, 25 Nov 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>move mod_limit to cache_db and clean up vm legacy code</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_limitmod_limitc">freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c</a></li>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_voicemailmod_voicemailc">freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_core_sqldbc">freeswitch/trunk/src/switch_core_sqldb.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodapplicationsmod_limitmod_limitc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (15676 => 15677)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c        2009-11-25 23:09:23 UTC (rev 15676)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c        2009-11-26 00:07:24 UTC (rev 15677)
</span><span class="lines">@@ -47,12 +47,13 @@
</span><span class="cx">         char hostname[256];
</span><span class="cx">         char *dbname;
</span><span class="cx">         char *odbc_dsn;
</span><ins>+        char *odbc_user;
+        char *odbc_pass;
</ins><span class="cx">         switch_mutex_t *mutex;
</span><span class="cx">         switch_mutex_t *limit_hash_mutex;
</span><span class="cx">         switch_hash_t *limit_hash;        
</span><span class="cx">         switch_mutex_t *db_hash_mutex;
</span><span class="cx">         switch_hash_t *db_hash;        
</span><del>-        switch_odbc_handle_t *master_odbc;
</del><span class="cx"> } globals;
</span><span class="cx">
</span><span class="cx"> typedef struct {
</span><span class="lines">@@ -88,38 +89,47 @@
</span><span class="cx">         " url VARCHAR(255)\n"
</span><span class="cx">         ");\n";
</span><span class="cx">
</span><ins>+
+switch_cache_db_handle_t *limit_get_db_handle(void)
+{
+        switch_cache_db_connection_options_t options = { {0} };
+        switch_cache_db_handle_t *dbh = NULL;
+        
+        if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
+                options.odbc_options.dsn = globals.odbc_dsn;
+                options.odbc_options.user = globals.odbc_user;
+                options.odbc_options.pass = globals.odbc_pass;
+
+                if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+                return dbh;
+        } else {
+                options.core_db_options.db_path = globals.dbname;
+                if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+                return dbh;
+        }
+}
+
+
</ins><span class="cx"> static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
</span><span class="cx"> {
</span><del>-        switch_core_db_t *db;
-        switch_status_t status = SWITCH_STATUS_SUCCESS;
</del><ins>+        switch_cache_db_handle_t *dbh = NULL;
+        switch_status_t status = SWITCH_STATUS_FALSE;
</ins><span class="cx">
</span><span class="cx">         if (mutex) {
</span><span class="cx">                 switch_mutex_lock(mutex);
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if (switch_odbc_available() && globals.odbc_dsn) {
-                switch_odbc_statement_handle_t stmt;
-                if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
-                        char *err_str;
-                        err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
-                        if (!zstr(err_str)) {
-                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
-                        }
-                        switch_safe_free(err_str);
-                        status = SWITCH_STATUS_FALSE;
-                }
-                switch_odbc_statement_handle_free(&stmt);
-        } else {
-                if (!(db = switch_core_db_open_file(globals.dbname))) {
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
-                        status = SWITCH_STATUS_FALSE;
-                        goto end;
-                }
-                status = switch_core_db_persistant_execute(db, sql, 1);
-                switch_core_db_close(db);
</del><ins>+        if (!(dbh = limit_get_db_handle())) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+                goto end;
</ins><span class="cx">         }
</span><span class="cx">
</span><ins>+        status = switch_cache_db_execute_sql(dbh, sql, NULL);
+
</ins><span class="cx"> end:
</span><ins>+        
+        switch_cache_db_release_db_handle(&dbh);
+
</ins><span class="cx">         if (mutex) {
</span><span class="cx">                 switch_mutex_unlock(mutex);
</span><span class="cx">         }
</span><span class="lines">@@ -130,34 +140,29 @@
</span><span class="cx"> static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
</span><span class="cx"> {
</span><span class="cx">         switch_bool_t ret = SWITCH_FALSE;
</span><del>-        switch_core_db_t *db;
</del><span class="cx">         char *errmsg = NULL;
</span><del>-
</del><ins>+        switch_cache_db_handle_t *dbh = NULL;
+        
</ins><span class="cx">         if (mutex) {
</span><span class="cx">                 switch_mutex_lock(mutex);
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if (switch_odbc_available() && globals.odbc_dsn) {
-                switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata, NULL);
-        } else {
-                if (!(db = switch_core_db_open_file(globals.dbname))) {
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
-                        goto end;
-                }
</del><ins>+        if (!(dbh = limit_get_db_handle())) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+ goto end;
+ }
+        
+        switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, &errmsg);
</ins><span class="cx">
</span><del>-                switch_core_db_exec(db, sql, callback, pdata, &errmsg);
-
-                if (errmsg) {
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
-                        free(errmsg);
-                }
-
-                if (db) {
-                        switch_core_db_close(db);
-                }
</del><ins>+        if (errmsg) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
+                free(errmsg);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> end:
</span><ins>+
+        switch_cache_db_release_db_handle(&dbh);
+
</ins><span class="cx">         if (mutex) {
</span><span class="cx">                 switch_mutex_unlock(mutex);
</span><span class="cx">         }
</span><span class="lines">@@ -165,6 +170,7 @@
</span><span class="cx">         return ret;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> static switch_xml_config_string_options_t limit_config_dsn = { NULL, 0, "[^:]+:[^:]+:.+" };
</span><span class="cx">
</span><span class="cx"> static switch_xml_config_item_t config_settings[] = {
</span><span class="lines">@@ -175,10 +181,8 @@
</span><span class="cx">
</span><span class="cx"> static switch_status_t do_config()
</span><span class="cx"> {
</span><del>-        switch_core_db_t *db;
</del><ins>+        switch_cache_db_handle_t *dbh;
</ins><span class="cx">         switch_status_t status = SWITCH_STATUS_SUCCESS;
</span><del>-        char *odbc_user = NULL;
-        char *odbc_pass = NULL;
</del><span class="cx">         char *sql = NULL;
</span><span class="cx">         
</span><span class="cx">         limit_config_dsn.pool = globals.pool;
</span><span class="lines">@@ -187,24 +191,28 @@
</span><span class="cx">                 return SWITCH_STATUS_TERM;
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        if (switch_odbc_available() && globals.odbc_dsn) {
-                if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
-                        *odbc_user++ = '\0';
-                        if ((odbc_pass = strchr(odbc_user, ':'))) {
-                                *odbc_pass++ = '\0';
</del><ins>+        if (globals.odbc_dsn) {
+                if ((globals.odbc_user = strchr(globals.odbc_dsn, ':'))) {
+                        *globals.odbc_user++ = '\0';
+                        if ((globals.odbc_pass = strchr(globals.odbc_user, ':'))) {
+                                *globals.odbc_pass++ = '\0';
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        } else if (globals.odbc_dsn) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
</del><ins>+
+                if (!(dbh = limit_get_db_handle())) {
+                        globals.odbc_dsn = globals.odbc_user = globals.odbc_pass;
+                }
</ins><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">
</span><del>-        if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
</del><ins>+        if (zstr(globals.odbc_dsn) || zstr(globals.odbc_user) || zstr(globals.odbc_pass)) {
</ins><span class="cx">                 globals.dbname = "call_limit";
</span><ins>+                dbh = limit_get_db_handle();
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        if (switch_odbc_available() && globals.odbc_dsn) {
-                int x;
</del><ins>+
+        if (dbh) {
+                int x = 0;
</ins><span class="cx">                 char *indexes[] = {
</span><span class="cx">                         "create index ld_hostname on limit_data (hostname)",
</span><span class="cx">                         "create index ld_uuid on limit_data (uuid)",
</span><span class="lines">@@ -216,71 +224,24 @@
</span><span class="cx">                         "create index gd_url on group_data (url)",
</span><span class="cx">                         NULL
</span><span class="cx">                 };
</span><ins>+
</ins><span class="cx">                 
</span><span class="cx">
</span><del>-
-                if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-                        status = SWITCH_STATUS_FALSE;
-                        goto done;
-                }
-                if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-                        status = SWITCH_STATUS_FALSE;
-                        goto done;
-                }
-
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.odbc_dsn);
-                if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from limit_data", NULL) != SWITCH_STATUS_SUCCESS) {
-                        if (switch_odbc_handle_exec(globals.master_odbc, limit_sql, NULL) != SWITCH_STATUS_SUCCESS) {
-                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
-                        }
-                }
-                if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from db_data", NULL) != SWITCH_STATUS_SUCCESS) {
-                        if (switch_odbc_handle_exec(globals.master_odbc, db_sql, NULL) != SWITCH_STATUS_SUCCESS) {
-                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
-                        }
-                }
-                if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from group_data", NULL) != SWITCH_STATUS_SUCCESS) {
-                        if (switch_odbc_handle_exec(globals.master_odbc, group_sql, NULL) != SWITCH_STATUS_SUCCESS) {
-                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
-                        }
-                }
-
</del><ins>+                switch_cache_db_test_reactive(dbh, "select * from limit_data", NULL, limit_sql);
+                switch_cache_db_test_reactive(dbh, "select * from db_data", NULL, db_sql);
+                switch_cache_db_test_reactive(dbh, "select * from group_data", NULL, group_sql);
+                
</ins><span class="cx">                 for (x = 0; indexes[x]; x++) {
</span><del>-                        switch_odbc_handle_exec(globals.master_odbc, indexes[x], NULL);
</del><ins>+                        switch_cache_db_execute_sql(dbh, indexes[x], NULL);
</ins><span class="cx">                 }
</span><del>-        } else {
-                if ((db = switch_core_db_open_file(globals.dbname))) {
-                        switch_core_db_test_reactive(db, "select * from limit_data", NULL, limit_sql);
-                        switch_core_db_test_reactive(db, "select * from db_data", NULL, db_sql);
-                        switch_core_db_test_reactive(db, "select * from group_data", NULL, group_sql);
-                        
-                        switch_core_db_exec(db, "create index if not exists ld_hostname on limit_data (hostname)", NULL, NULL, NULL);
-                        switch_core_db_exec(db, "create index if not exists ld_uuid on limit_data (uuid)", NULL, NULL, NULL);
-                        switch_core_db_exec(db, "create index if not exists ld_realm on limit_data (realm)", NULL, NULL, NULL);
-                        switch_core_db_exec(db, "create index if not exists ld_id on limit_data (id)", NULL, NULL, NULL);
</del><ins>+        
+                switch_cache_db_release_db_handle(&dbh);
</ins><span class="cx">
</span><del>-                        switch_core_db_exec(db, "create index if not exists dd_realm on db_data (realm)", NULL, NULL, NULL);
-                        switch_core_db_exec(db, "create index if not exists dd_data_key on db_data (data_key)", NULL, NULL, NULL);
-
-                        switch_core_db_exec(db, "create index if not exists gd_groupname on group_data (groupname)", NULL, NULL, NULL);
-                        switch_core_db_exec(db, "create index if not exists gd_url on group_data (url)", NULL, NULL, NULL);
-
-                } else {
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
-                        status = SWITCH_STATUS_FALSE;
-                        goto done;
-                }
-                switch_core_db_close(db);
</del><ins>+                sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname);
+                limit_execute_sql(sql, globals.mutex);
+                switch_safe_free(sql);
</ins><span class="cx">         }
</span><span class="cx">
</span><del>- done:
-
-        sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname);
-        limit_execute_sql(sql, globals.mutex);
-        switch_safe_free(sql);
-
</del><span class="cx">         return status;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1719,10 +1680,6 @@
</span><span class="cx"> SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_limit_shutdown)
</span><span class="cx"> {
</span><span class="cx">         
</span><del>-        if (globals.master_odbc) {
-                switch_odbc_handle_destroy(&globals.master_odbc);
-        }
-        
</del><span class="cx">         switch_event_free_subclass(LIMIT_EVENT_USAGE);
</span><span class="cx">         
</span><span class="cx">         switch_xml_config_cleanup(config_settings);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodapplicationsmod_voicemailmod_voicemailc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (15676 => 15677)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c        2009-11-25 23:09:23 UTC (rev 15676)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c        2009-11-26 00:07:24 UTC (rev 15677)
</span><span class="lines">@@ -142,7 +142,6 @@
</span><span class="cx">         uint32_t record_threshold;
</span><span class="cx">         uint32_t record_silence_hits;
</span><span class="cx">         uint32_t record_sample_rate;
</span><del>-        switch_odbc_handle_t *master_odbc;
</del><span class="cx">         switch_bool_t auto_playback_recordings;
</span><span class="cx">         switch_thread_rwlock_t *rwlock;
</span><span class="cx">         switch_memory_pool_t *pool;
</span><span class="lines">@@ -276,10 +275,6 @@
</span><span class="cx"> static void free_profile(vm_profile_t *profile)
</span><span class="cx"> {
</span><span class="cx">         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
</span><del>-        if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Closing ODBC Database! %s\n", profile->name);
-                switch_odbc_handle_destroy(&profile->master_odbc);
-        }
</del><span class="cx">         switch_core_destroy_memory_pool(&profile->pool);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4122,10 +4117,6 @@
</span><span class="cx">                 
</span><span class="cx">                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
</span><span class="cx">
</span><del>-                if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Closing ODBC Database! %s\n", profile->name);
-                        switch_odbc_handle_destroy(&profile->master_odbc);
-                }
</del><span class="cx">                 switch_core_destroy_memory_pool(&profile->pool);
</span><span class="cx">                 profile = NULL;
</span><span class="cx">         }
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_core_sqldbc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_core_sqldb.c (15676 => 15677)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_core_sqldb.c        2009-11-25 23:09:23 UTC (rev 15676)
+++ freeswitch/trunk/src/switch_core_sqldb.c        2009-11-26 00:07:24 UTC (rev 15677)
</span><span class="lines">@@ -638,7 +638,9 @@
</span><span class="cx">         case SCDB_TYPE_ODBC:
</span><span class="cx">                 {
</span><span class="cx">                         if (switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
</span><del>-                                switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, drop_sql, NULL);
</del><ins>+                                if (drop_sql) {
+                                        switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, drop_sql, NULL);
+                                }
</ins><span class="cx">                                 switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, reactive_sql, NULL);
</span><span class="cx">                         }
</span><span class="cx">                 }
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>