create indexes for ODBC as well

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12235 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-02-23 01:49:49 +00:00
parent 35fd710488
commit 756575788b
2 changed files with 75 additions and 18 deletions

View File

@@ -211,6 +211,21 @@ static switch_status_t do_config()
#ifdef SWITCH_HAVE_ODBC
if (globals.odbc_dsn) {
int x;
char *indexes[] = {
"create index ld_hostname on limit_data (hostname)",
"create index ld_uuid on limit_data (uuid)",
"create index ld_realm on limit_data (realm)",
"create index ld_id on limit_data (id)",
"create index dd_realm on db_data (realm)",
"create index dd_data_key on db_data (data_key)",
"create index gd_groupname on group_data (groupname)",
"create index gd_url on group_data (url)",
NULL
};
if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
status = SWITCH_STATUS_FALSE;
@@ -238,6 +253,10 @@ static switch_status_t do_config()
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
}
}
for (x = 0; indexes[x]; x++) {
switch_odbc_handle_exec(globals.master_odbc, indexes[x], NULL);
}
} else {
#endif
if ((db = switch_core_db_open_file(globals.dbname))) {