refactor/abstract the core sql stuff more

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15599 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-11-21 17:57:55 +00:00
parent a61b0d2d12
commit 506aae7cbe
3 changed files with 282 additions and 133 deletions

View File

@@ -1470,10 +1470,17 @@ static void switch_load_core_config(const char *file)
*/
SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t **dbh, const char *file, const char *func, int line)
{
switch_cache_db_connection_options_t options = { {0} };
if (runtime.odbc_dsn && runtime.odbc_user && runtime.odbc_pass) {
return _switch_cache_db_get_db_handle(dbh, runtime.odbc_dsn, runtime.odbc_user, runtime.odbc_pass, file, func, line);
options.odbc_options.dsn = runtime.odbc_dsn;
options.odbc_options.user = runtime.odbc_user;
options.odbc_options.pass = runtime.odbc_pass;
return _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_ODBC, &options, file, func, line);
} else {
return _switch_cache_db_get_db_handle(dbh, SWITCH_CORE_DB, NULL, NULL, file, func, line);
options.core_db_options.db_path = SWITCH_CORE_DB;
return _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_CORE_DB, &options, file, func, line);
}
}