update sql

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6671 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-12-11 20:50:52 +00:00
parent 7536bed31d
commit 95d23e0186
1 changed files with 6 additions and 2 deletions

View File

@ -154,10 +154,12 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t * thread,
uint8_t trans = 0, nothing_in_queue = 0;
uint32_t target = 1000;
switch_size_t len = 0, sql_len = SQLLEN;
char *sqlbuf = (char *) malloc(sql_len);
char *tmp, *sqlbuf = (char *) malloc(sql_len);
char *sql;
switch_size_t newlen;
switch_assert(sqlbuf);
if (!sql_manager.event_db) {
sql_manager.event_db = switch_core_db_handle();
}
@ -180,10 +182,12 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t * thread,
itterations++;
if (len + newlen > sql_len) {
sql_len = len + SQLLEN;
if (!(sqlbuf = realloc(sqlbuf, sql_len))) {
if (!(tmp = realloc(sqlbuf, sql_len))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread ending on mem err\n");
abort();
break;
}
sqlbuf = tmp;
}
sprintf(sqlbuf + len, "%s;\n", sql);
len += newlen;