]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
return true/false from sql tester incase you want to do more stuff when the table...
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 Dec 2009 22:20:22 +0000 (22:20 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 Dec 2009 22:20:22 +0000 (22:20 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15981 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core.h
src/switch_core_sqldb.c

index 13e7e7a2f24d73aa5552a8eafdf573ac6a7d218d..dc9985dfe1a4f01320642c94bb30e3f3f9eafa99 100644 (file)
@@ -2038,7 +2038,8 @@ SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream);
 SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t **dbh, const char *file, const char *func, int line);
 #define switch_core_db_handle(_a) _switch_core_db_handle(_a, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-SWITCH_DECLARE(void) switch_cache_db_test_reactive(switch_cache_db_handle_t *db, const char *test_sql, const char *drop_sql, const char *reactive_sql);
+SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_handle_t *db, 
+                                                                                                                       const char *test_sql, const char *drop_sql, const char *reactive_sql);
 SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_db_handle_t *dbh, const char *sql, uint32_t retries);
 SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t *dbh, char *sql, uint32_t retries);
 SWITCH_DECLARE(void) switch_cache_db_detach(void);
index caeb1bf46895cc56dc9eec271ac5fe02d63d2618..a16886b3ce65c1f19425baa78ecf47439de203e4 100644 (file)
@@ -719,10 +719,11 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach
        return status;
 }
 
-SWITCH_DECLARE(void) switch_cache_db_test_reactive(switch_cache_db_handle_t *dbh, const char *test_sql, const char *drop_sql, const char *reactive_sql)
+SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_handle_t *dbh, 
+                                                                                                                       const char *test_sql, const char *drop_sql, const char *reactive_sql)
 {
        char *errmsg;
-
+       switch_bool_t r = SWITCH_TRUE;
 
        if (dbh->io_mutex) {
                switch_mutex_lock(dbh->io_mutex);
@@ -732,6 +733,7 @@ SWITCH_DECLARE(void) switch_cache_db_test_reactive(switch_cache_db_handle_t *dbh
        case SCDB_TYPE_ODBC:
                {
                        if (switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
+                               r = SWITCH_FALSE;
                                if (drop_sql) {
                                        switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, drop_sql, NULL);
                                }
@@ -745,6 +747,7 @@ SWITCH_DECLARE(void) switch_cache_db_test_reactive(switch_cache_db_handle_t *dbh
                                switch_core_db_exec(dbh->native_handle.core_db_dbh, test_sql, NULL, NULL, &errmsg);
 
                                if (errmsg) {
+                                       r = SWITCH_FALSE;
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\nAuto Generating Table!\n", errmsg, test_sql);
                                        switch_core_db_free(errmsg);
                                        errmsg = NULL;
@@ -772,6 +775,8 @@ SWITCH_DECLARE(void) switch_cache_db_test_reactive(switch_cache_db_handle_t *dbh
        if (dbh->io_mutex) {
                switch_mutex_unlock(dbh->io_mutex);
        }
+
+       return r;
 }