提交 f1b50440 authored 作者: Anthony Minessale's avatar Anthony Minessale

add core-db-inner-pre-trans-execute and core-db-inner-post-trans-execute to…

add core-db-inner-pre-trans-execute and core-db-inner-post-trans-execute to switch.conf.xml to wrap sql stmts inside the meat of the core transactions
上级 21b1ffbf
......@@ -263,6 +263,8 @@ struct switch_runtime {
uint32_t time_sync;
char *core_db_pre_trans_execute;
char *core_db_post_trans_execute;
char *core_db_inner_pre_trans_execute;
char *core_db_inner_post_trans_execute;
};
extern struct switch_runtime runtime;
......
......@@ -1727,6 +1727,10 @@ static void switch_load_core_config(const char *file)
runtime.core_db_pre_trans_execute = switch_core_strdup(runtime.memory_pool, val);
} else if (!strcasecmp(var, "core-db-post-trans-execute") && !zstr(val)) {
runtime.core_db_post_trans_execute = switch_core_strdup(runtime.memory_pool, val);
} else if (!strcasecmp(var, "core-db-inner-pre-trans-execute") && !zstr(val)) {
runtime.core_db_inner_pre_trans_execute = switch_core_strdup(runtime.memory_pool, val);
} else if (!strcasecmp(var, "core-db-inner-post-trans-execute") && !zstr(val)) {
runtime.core_db_inner_post_trans_execute = switch_core_strdup(runtime.memory_pool, val);
} else if (!strcasecmp(var, "mailer-app") && !zstr(val)) {
runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val);
} else if (!strcasecmp(var, "mailer-app-args") && val) {
......
......@@ -734,7 +734,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
if (!zstr(runtime.core_db_pre_trans_execute)) {
switch_cache_db_execute_sql_real(dbh, runtime.core_db_pre_trans_execute, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC [%s]\n", errmsg);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC %s [%s]\n", runtime.core_db_pre_trans_execute, errmsg);
free(errmsg);
}
}
......@@ -789,6 +789,15 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
break;
}
if (!zstr(runtime.core_db_inner_pre_trans_execute)) {
switch_cache_db_execute_sql_real(dbh, runtime.core_db_inner_pre_trans_execute, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC %s [%s]\n", runtime.core_db_inner_pre_trans_execute, errmsg);
free(errmsg);
}
}
while (retries > 0) {
switch_cache_db_execute_sql(dbh, sql, &errmsg);
......@@ -809,6 +818,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
}
}
if (!zstr(runtime.core_db_inner_post_trans_execute)) {
switch_cache_db_execute_sql_real(dbh, runtime.core_db_inner_post_trans_execute, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC %s [%s]\n", runtime.core_db_inner_post_trans_execute, errmsg);
free(errmsg);
}
}
done:
if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
......@@ -821,7 +838,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
if (!zstr(runtime.core_db_post_trans_execute)) {
switch_cache_db_execute_sql_real(dbh, runtime.core_db_post_trans_execute, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC [%s]\n", errmsg);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC %s [%s]\n", runtime.core_db_post_trans_execute, errmsg);
free(errmsg);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论