yay wasim found a bug i can actually fix right away for once

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7898 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-03-17 15:44:09 +00:00
parent 8033a4790c
commit 88ac83b4f4
1 changed files with 7 additions and 2 deletions

View File

@ -79,12 +79,13 @@ SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, s
{
int ret = 0;
int sane = 100;
char *err = NULL;
while(--sane > 0) {
ret = sqlite3_exec(db, sql, callback, data, errmsg);
ret = sqlite3_exec(db, sql, callback, data, &err);
if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
if (sane > 1) {
switch_safe_free(*errmsg);
switch_safe_free(err);
switch_yield(1000);
continue;
}
@ -93,6 +94,10 @@ SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, s
}
}
if (err && errmsg) {
*errmsg = err;
}
return ret;
}