add dedicated mutex for select based sql stuff

This commit is contained in:
Anthony Minessale committed 2013-02-25 15:42:26 -06:00
1 parent 42de032273
commit 8987e96744
6 files changed
+64 -61

No files matched your search

+17 -16
View File
@@ -6445,15 +6445,16 @@ void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql,
{
switch_cache_db_handle_t *dbh = NULL;
if (mutex) {
switch_mutex_lock(mutex);
}
if (!(dbh = sofia_glue_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
return;
}
if (mutex) {
switch_mutex_lock(mutex);
}
switch_cache_db_persistant_execute_trans_full(dbh, sql, 1,
profile->pre_trans_execute,
profile->post_trans_execute,
@@ -6473,15 +6474,15 @@ void sofia_glue_actually_execute_sql(sofia_profile_t *profile, char *sql, switch
switch_cache_db_handle_t *dbh = NULL;
char *err = NULL;
if (mutex) {
switch_mutex_lock(mutex);
}
if (!(dbh = sofia_glue_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
return;
}
if (mutex) {
switch_mutex_lock(mutex);
}
switch_cache_db_execute_sql(dbh, sql, &err);
if (mutex) {
@@ -6503,15 +6504,15 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
char *errmsg = NULL;
switch_cache_db_handle_t *dbh = NULL;
if (mutex) {
switch_mutex_lock(mutex);
}
if (!(dbh = sofia_glue_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
return ret;
}
if (mutex) {
switch_mutex_lock(mutex);
}
switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, &errmsg);
if (mutex) {
@@ -6537,15 +6538,15 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex
char *err = NULL;
switch_cache_db_handle_t *dbh = NULL;
if (mutex) {
switch_mutex_lock(mutex);
}
if (!(dbh = sofia_glue_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
return NULL;
}
if (mutex) {
switch_mutex_lock(mutex);
}
ret = switch_cache_db_execute_sql2str(dbh, sql, resbuf, len, &err);
if (mutex) {