mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-08 21:31:51 +00:00
Document Dbh.test_reactive, return saner values
In the FreeSWITCH core, the return value of switch_case_db_test_reactive is ignored, but it is usable in LUA modules (and other bindings via SWIG). The LUA API example[1] shows how to check the return value, but that example miserably fails if the database did not exist before. Changes: - Document the expected behavior of the test_reactive function. - Assert that test_sql and sql_reactive are both given. If either query is not given, the caller is using the wrong API. - When SCF_AUTO_SCHEMAS is cleared, use the return value of the test_sql execution. Does anybody use this? Why not remove it? - Do not unconditionally return SWITCH_FALSE when test_sql fails, instead allow it to become SWITCH_TRUE when reactive_sql passes. - Remove the unnecessary test_sql check for SCDB_TYPE_CORE_DB (this is now enforced through an assert check). (+reindent) - Clarify the error message of drop_sql, prepending "Ignoring" to the "SQL ERR" message. - LUA: Do not print "DBH NOT Connected" if the query fails. This was the initial source of confusion. [1]: https://confluence.freeswitch.org/display/FREESWITCH/Lua+API+Reference
This commit is contained in:
@@ -394,9 +394,9 @@ bool Dbh::test_reactive(char *test_sql, char *drop_sql, char *reactive_sql)
|
||||
if (switch_cache_db_test_reactive(dbh, test_sql, drop_sql, reactive_sql) == SWITCH_TRUE) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DBH NOT Connected.\n");
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DBH NOT Connected.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user