Permalink
Browse files

Synced sqlite3utils with private and fixed a small recursive bug in S…

…IPEngine that was already fixed in private

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4912 19bc5d8c-e614-43d4-8b26-e1612bc8e597
  • Loading branch information...
1 parent b493534 commit 792db13020278d9b466b4f8348cd7648288c31c3 kurtis.heimerl committed Feb 15, 2013
Showing with 16 additions and 9 deletions.
  1. +15 −8 CommonLibs/sqlite3util.cpp
  2. +1 −1 SIP/SIPEngine.cpp
View
23 CommonLibs/sqlite3util.cpp
@@ -1,6 +1,6 @@
/*
-* Written by David A. Burgess, Kestrel Signal Processing, Inc., 2010
-* The author disclaims copyright to this source code.
+* Copyright 2010 Kestrel Signal Processing, Inc.
+* All rights reserved.
*/
@@ -17,12 +17,18 @@
int sqlite3_prepare_statement(sqlite3* DB, sqlite3_stmt **stmt, const char* query)
{
- int prc = sqlite3_prepare_v2(DB,query,strlen(query),stmt,NULL);
- if (prc) {
- fprintf(stderr,"sqlite3_prepare_v2 failed for \"%s\": %s\n",query,sqlite3_errmsg(DB));
- sqlite3_finalize(*stmt);
- }
- return prc;
+ int src = SQLITE_BUSY;
+ while (src==SQLITE_BUSY) {
+ src = sqlite3_prepare_v2(DB,query,strlen(query),stmt,NULL);
+ if (src==SQLITE_BUSY) {
+ usleep(100000);
+ }
+ }
+ if (src) {
+ fprintf(stderr,"sqlite3_prepare_v2 failed for \"%s\": %s\n",query,sqlite3_errmsg(DB));
+ sqlite3_finalize(*stmt);
+ }
+ return src;
}
int sqlite3_run_query(sqlite3* DB, sqlite3_stmt *stmt)
@@ -140,6 +146,7 @@ bool sqlite3_command(sqlite3* DB, const char* query)
if (sqlite3_prepare_statement(DB,&stmt,query)) return false;
// Run the query.
int src = sqlite3_run_query(DB,stmt);
+ sqlite3_finalize(stmt);
return src==SQLITE_DONE;
}
View
2 SIP/SIPEngine.cpp
@@ -114,7 +114,7 @@ ostream& SIP::operator<<(ostream& os, SIPState s)
{
const char* str = SIPStateString(s);
if (str) os << str;
- else os << "?" << s << "?";
+ else os << "?" << ((int)s) << "?";
return os;
}

0 comments on commit 792db13

Please sign in to comment.