]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Fixed sqlite so it doesn't core when loading tables.
authorsplidge <redacted>
Wed, 19 Mar 2008 22:48:33 +0000 (22:48 +0000)
committersplidge <redacted>
Wed, 19 Mar 2008 22:48:33 +0000 (22:48 +0000)
sqlite/sqlite.c

index c4bb25a721fb34e04df367a36bf9c0b4c50ff0fe..20385791d803d042ee952fce3f8026abdcb2f13e 100644 (file)
@@ -71,7 +71,7 @@ int sqlitestep(sqlite3_stmt *s) {
   for(;;) {
     rc = sqlite3_step(s);
     if((rc == SQLITE_ROW) || (rc == SQLITE_OK) || (rc == SQLITE_DONE))
-      return 1;
+      return rc;
     if(rc == SQLITE_BUSY) {
       t.tv_nsec = rand() % 50 + 50;
       Error("sqlite", ERR_WARNING, "SQLite is busy, retrying in %dns...", t.tv_nsec);
@@ -143,7 +143,7 @@ SQLiteResult *sqlitegetresult(SQLiteConn *r) {
 }
 
 int sqlitefetchrow(SQLiteResult *r) {
-  if(!sqlitestep(r->r))
+  if(sqlitestep(r->r) != SQLITE_ROW)
     return 0;
 
   return 1;
@@ -182,7 +182,7 @@ void sqliteloadtable(char *tablename, SQLiteQueryHandler init, SQLiteQueryHandle
     return;
   }
 
-  if(!sqlitestep(s)) {
+  if(sqlitestep(s) != SQLITE_ROW) {
     Error("sqlite", ERR_ERROR, "Error getting row count for %s.", tablename);
     sqlite3_finalize(s);
     return;