add support for running core-db over odbc

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15487 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2009-11-17 00:12:54 +00:00
1 parent 220ebe8175
commit 5d815cfdfe
18 files changed
+692 -346

No files matched your search

@@ -186,7 +186,7 @@ static switch_bool_t cidlookup_execute_sql_callback(char *sql, switch_core_db_ca
switch_mutex_lock(globals.db_mutex);
if (globals.odbc_dsn) {
if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata)
if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata, NULL)
== SWITCH_ODBC_FAIL) {
retval = SWITCH_FALSE;
} else {
@@ -2914,7 +2914,7 @@ SWITCH_STANDARD_API(show_function)
{
char sql[1024];
char *errmsg;
switch_core_db_t *db;
switch_cache_db_handle_t *db;
struct holder holder = { 0 };
int help = 0;
char *mydata = NULL, *argv[6] = { 0 };
@@ -2923,7 +2923,7 @@ SWITCH_STANDARD_API(show_function)
switch_core_flag_t cflags = switch_core_flags();
switch_status_t status = SWITCH_STATUS_SUCCESS;
db = switch_core_db_handle();
switch_core_db_handle(&db);
holder.justcount = 0;
@@ -3090,7 +3090,7 @@ SWITCH_STANDARD_API(show_function)
holder.delim = ",";
}
}
switch_core_db_exec(db, sql, show_callback, &holder, &errmsg);
switch_cache_db_execute_sql_callback(db, sql, show_callback, &holder, &errmsg);
if (holder.http) {
holder.stream->write_function(holder.stream, "</table>");
}
@@ -3106,7 +3106,7 @@ SWITCH_STANDARD_API(show_function)
stream->write_function(stream, "\n%u total.\n", holder.count);
}
} else if (!strcasecmp(as, "xml")) {
switch_core_db_exec(db, sql, show_as_xml_callback, &holder, &errmsg);
switch_cache_db_execute_sql_callback(db, sql, show_as_xml_callback, &holder, &errmsg);
if (errmsg) {
stream->write_function(stream, "-ERR SQL Error [%s]\n", errmsg);
@@ -3141,7 +3141,7 @@ SWITCH_STANDARD_API(show_function)
switch_safe_free(mydata);
if (db) {
switch_core_db_close(db);
switch_cache_db_release_db_handle(&db);
}
return status;
@@ -336,7 +336,7 @@ SWITCH_STANDARD_APP(eavesdrop_function)
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *require_group = switch_channel_get_variable(channel, "eavesdrop_require_group");
if (!strcasecmp((char *) data, "all")) {
switch_core_db_t *db = switch_core_db_handle();
switch_cache_db_handle_t *db = NULL;
char *errmsg = NULL;
struct e_data e_data = { {0} };
char *sql = switch_mprintf("select uuid from channels where uuid != '%q'", switch_core_session_get_uuid(session));
@@ -347,12 +347,14 @@ SWITCH_STANDARD_APP(eavesdrop_function)
char terminator;
switch_status_t status;
switch_core_db_handle(&db);
while (switch_channel_ready(channel)) {
for (x = 0; x < MAX_SPY; x++) {
switch_safe_free(e_data.uuid_list[x]);
}
e_data.total = 0;
switch_core_db_exec(db, sql, e_callback, &e_data, &errmsg);
switch_cache_db_execute_sql_callback(db, sql, e_callback, &e_data, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error: %s\n", errmsg);
switch_core_db_free(errmsg);
@@ -393,7 +395,7 @@ SWITCH_STANDARD_APP(eavesdrop_function)
}
free(sql);
switch_core_db_close(db);
switch_cache_db_release_db_handle(&db);
} else {
switch_ivr_eavesdrop_session(session, data, require_group, ED_DTMF);
+1 -1
View File
@@ -339,7 +339,7 @@ static switch_bool_t fifo_execute_sql_callback(switch_mutex_t *mutex, char *sql,
}
if (switch_odbc_available() && globals.odbc_dsn) {
switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata);
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);
+1 -1
View File
@@ -138,7 +138,7 @@ static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex, char *sql
}
if (switch_odbc_available() && globals.odbc_dsn) {
switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata);
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);
@@ -201,7 +201,7 @@ static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile, switch_mutex
}
if (switch_odbc_available() && profile->odbc_dsn) {
switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata, NULL);
} else {
if (!(db = switch_core_db_open_file(profile->dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);