mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-18 17:41:53 +00:00
FS-3961 --resolve
This commit is contained in:
parent
b1281985d5
commit
f38c287a4b
@ -385,6 +385,7 @@ bool Dbh::test_reactive(char *test_sql, char *drop_sql, char *reactive_sql)
|
|||||||
int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv)
|
int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv)
|
||||||
{
|
{
|
||||||
SWIGLUA_FN *lua_fun = (SWIGLUA_FN *)pArg;
|
SWIGLUA_FN *lua_fun = (SWIGLUA_FN *)pArg;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
lua_pushvalue(lua_fun->L, lua_fun->idx); /* get the lua callback function onto the stack */
|
lua_pushvalue(lua_fun->L, lua_fun->idx); /* get the lua callback function onto the stack */
|
||||||
|
|
||||||
@ -396,13 +397,13 @@ int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv)
|
|||||||
lua_settable(lua_fun->L, -3);
|
lua_settable(lua_fun->L, -3);
|
||||||
}
|
}
|
||||||
|
|
||||||
docall(lua_fun->L, 1, 1, 1); /* 1 in, 1 out */
|
docall(lua_fun->L, 1, 0, 1);
|
||||||
|
ret = lua_tonumber(lua_fun->L, -1);
|
||||||
|
lua_pop(lua_fun->L, 1);
|
||||||
|
|
||||||
if (lua_isnumber(lua_fun->L, -1)) {
|
if (ret != 0) {
|
||||||
if (lua_tonumber(lua_fun->L, -1) != 0) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0; /* 0 to continue with next row */
|
return 0; /* 0 to continue with next row */
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,12 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t
|
|||||||
break;
|
break;
|
||||||
case SCDB_TYPE_CORE_DB:
|
case SCDB_TYPE_CORE_DB:
|
||||||
{
|
{
|
||||||
status = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, NULL, NULL, &errmsg);
|
int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, NULL, NULL, &errmsg);
|
||||||
|
|
||||||
|
if (ret == SWITCH_CORE_DB_OK) {
|
||||||
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
if (errmsg) {
|
if (errmsg) {
|
||||||
switch_strdup(tmp, errmsg);
|
switch_strdup(tmp, errmsg);
|
||||||
switch_core_db_free(errmsg);
|
switch_core_db_free(errmsg);
|
||||||
@ -832,7 +837,11 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach
|
|||||||
break;
|
break;
|
||||||
case SCDB_TYPE_CORE_DB:
|
case SCDB_TYPE_CORE_DB:
|
||||||
{
|
{
|
||||||
status = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, callback, pdata, &errmsg);
|
int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, callback, pdata, &errmsg);
|
||||||
|
|
||||||
|
if (ret == SWITCH_CORE_DB_OK || ret == SWITCH_CORE_DB_ABORT) {
|
||||||
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
if (errmsg) {
|
if (errmsg) {
|
||||||
dbh->last_used = switch_epoch_time_now(NULL) - (SQL_CACHE_TIMEOUT * 2);
|
dbh->last_used = switch_epoch_time_now(NULL) - (SQL_CACHE_TIMEOUT * 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user