From 753282f38a49f32f36c16958acfec6fd01d7fda5 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 17 Apr 2013 09:21:14 -0500 Subject: [PATCH] FS-5314 --resolve (cherry picked from commit 40e33572b34e777deca8629bee1dc0cc3143e0ea) --- .../mod_nibblebill/mod_nibblebill.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_nibblebill/mod_nibblebill.c b/src/mod/applications/mod_nibblebill/mod_nibblebill.c index 3b5703a9e2..a16c51cdfa 100755 --- a/src/mod/applications/mod_nibblebill/mod_nibblebill.c +++ b/src/mod/applications/mod_nibblebill/mod_nibblebill.c @@ -174,6 +174,24 @@ static switch_bool_t nibblebill_execute_sql_callback(char *sql, switch_core_db_c return retval; } +static switch_bool_t nibblebill_execute_sql(char *sql) +{ + switch_bool_t retval = SWITCH_FALSE; + switch_cache_db_handle_t *dbh = NULL; + + if (globals.odbc_dsn && (dbh = nibblebill_get_db_handle())) { + + if ( switch_cache_db_execute_sql(dbh, sql, NULL ) != SWITCH_STATUS_SUCCESS ) { + retval = SWITCH_FALSE; + } else { + retval = SWITCH_TRUE; + } + } + switch_cache_db_release_db_handle(&dbh); + + return retval; +} + static switch_status_t nibblebill_load_config(void) { @@ -354,7 +372,7 @@ static switch_bool_t bill_event(double billamount, const char *billaccount, swit } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing update query\n[%s]\n", sql); - status = nibblebill_execute_sql_callback(sql, nibblebill_callback, NULL); + status = nibblebill_execute_sql(sql); switch_safe_free(dsql); return status;