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

add auto-clear-sql param to core

上级 7dc92c47
...@@ -276,7 +276,8 @@ typedef enum { ...@@ -276,7 +276,8 @@ typedef enum {
SCF_USE_WIN32_MONOTONIC = (1 << 12), SCF_USE_WIN32_MONOTONIC = (1 << 12),
SCF_AUTO_SCHEMAS = (1 << 13), SCF_AUTO_SCHEMAS = (1 << 13),
SCF_MINIMAL = (1 << 14), SCF_MINIMAL = (1 << 14),
SCF_USE_NAT_MAPPING = (1 << 15) SCF_USE_NAT_MAPPING = (1 << 15),
SCF_CLEAR_SQL = (1 << 16)
} switch_core_flag_enum_t; } switch_core_flag_enum_t;
typedef uint32_t switch_core_flag_t; typedef uint32_t switch_core_flag_t;
......
...@@ -1358,6 +1358,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc ...@@ -1358,6 +1358,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data); runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data);
switch_set_flag((&runtime.dummy_cng_frame), SFF_CNG); switch_set_flag((&runtime.dummy_cng_frame), SFF_CNG);
switch_set_flag((&runtime), SCF_AUTO_SCHEMAS); switch_set_flag((&runtime), SCF_AUTO_SCHEMAS);
switch_set_flag((&runtime), SCF_CLEAR_SQL);
switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS); switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
runtime.hard_log_level = SWITCH_LOG_DEBUG; runtime.hard_log_level = SWITCH_LOG_DEBUG;
...@@ -1675,6 +1676,12 @@ static void switch_load_core_config(const char *file) ...@@ -1675,6 +1676,12 @@ static void switch_load_core_config(const char *file)
} else { } else {
switch_clear_flag((&runtime), SCF_AUTO_SCHEMAS); switch_clear_flag((&runtime), SCF_AUTO_SCHEMAS);
} }
} else if (!strcasecmp(var, "auto-clear-sql")) {
if (switch_true(val)) {
switch_set_flag((&runtime), SCF_CLEAR_SQL);
} else {
switch_clear_flag((&runtime), SCF_CLEAR_SQL);
}
} else if (!strcasecmp(var, "enable-early-hangup") && switch_true(val)) { } else if (!strcasecmp(var, "enable-early-hangup") && switch_true(val)) {
switch_set_flag((&runtime), SCF_EARLY_HANGUP); switch_set_flag((&runtime), SCF_EARLY_HANGUP);
} else if (!strcasecmp(var, "colorize-console") && switch_true(val)) { } else if (!strcasecmp(var, "colorize-console") && switch_true(val)) {
......
...@@ -214,6 +214,10 @@ SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *te ...@@ -214,6 +214,10 @@ SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *te
{ {
char *errmsg; char *errmsg;
if (!switch_test_flag((&runtime), SCF_CLEAR_SQL)) {
return;
}
if (!switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) { if (!switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) {
switch_core_db_exec(db, test_sql, NULL, NULL, NULL); switch_core_db_exec(db, test_sql, NULL, NULL, NULL);
return; return;
......
...@@ -852,6 +852,10 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand ...@@ -852,6 +852,10 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand
switch_bool_t r = SWITCH_TRUE; switch_bool_t r = SWITCH_TRUE;
switch_mutex_t *io_mutex = dbh->io_mutex; switch_mutex_t *io_mutex = dbh->io_mutex;
if (!switch_test_flag((&runtime), SCF_CLEAR_SQL)) {
return SWITCH_TRUE;
}
if (!switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) { if (!switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) {
switch_cache_db_execute_sql(dbh, (char *)test_sql, NULL); switch_cache_db_execute_sql(dbh, (char *)test_sql, NULL);
return SWITCH_TRUE; return SWITCH_TRUE;
...@@ -1894,7 +1898,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ ...@@ -1894,7 +1898,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
switch (dbh->type) { switch (dbh->type) {
case SCDB_TYPE_ODBC: case SCDB_TYPE_ODBC:
{ if (switch_test_flag((&runtime), SCF_CLEAR_SQL)) {
char sql[512] = ""; char sql[512] = "";
char *tables[] = { "channels", "calls", "interfaces", "tasks", NULL }; char *tables[] = { "channels", "calls", "interfaces", "tasks", NULL };
int i; int i;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论