]> jfr.im git - irc/quakenet/newserv.git/blobdiff - sqlite/sqlite.c
CHANSERV: reduce reason to 15 chars
[irc/quakenet/newserv.git] / sqlite / sqlite.c
index 746f7848aea4b8d5a7cdf920ed3756487f5bb21e..7b97264244132dd651ef54dc5189666623d80e78 100644 (file)
@@ -7,7 +7,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#ifndef __USE_POSIX199309
 #define __USE_POSIX199309
+#endif
+
 #include <time.h>
 
 #include "../core/config.h"
@@ -45,8 +48,6 @@ static int inited;
 
 #define SYNC_MODE "OFF"
 
-#define FLAG_DONTFREE 0x02
-
 static void sqlitequeueprocessor(void *arg);
 static void dbstatus(int hooknum, void *arg);
 
@@ -135,7 +136,6 @@ static void processstatement(int rc, sqlite3_stmt *s, SQLiteQueryHandler handler
 
     r = (SQLiteResult *)nsmalloc(POOL_SQLITE, sizeof(SQLiteResult));
     r->r = s;
-    r->flags = 0;
     r->first = 1;
     if(rc == SQLITE_ROW) {
       r->final = 0;
@@ -295,9 +295,6 @@ void sqliteclear(SQLiteResult *r) {
   if(!r)
     return;
 
-  if(r->flags & FLAG_DONTFREE)
-    return;
-
   if(r->r)
     sqlite3_finalize(r->r);
 
@@ -319,28 +316,20 @@ struct sqlitetableloader {
 
 static void loadtablerows(SQLiteConn *c, void *tag) {
   struct sqlitetableloader *t = (struct sqlitetableloader *)tag;
-  SQLiteResult *r = (SQLiteResult *)c;
 
   if(!c) { /* pqsql doesnt call the handlers so we don't either */
     nsfree(POOL_SQLITE, t);
     return;
   }
 
-  r->flags|=FLAG_DONTFREE;
-
   /* the handlers do all the checking and cleanup */
   if(t->init)
-    (t->init)(c, t->tag);
-
-  if(!t->fini)
-    r->flags&=~FLAG_DONTFREE;
+    (t->init)(NULL, t->tag);
 
   (t->data)(c, t->tag);
 
-  r->flags&=~FLAG_DONTFREE;
-
   if(t->fini)
-    (t->fini)(c, t->tag);
+    (t->fini)(NULL, t->tag);
 
   nsfree(POOL_SQLITE, t);
 }
@@ -463,3 +452,6 @@ static void dbstatus(int hooknum, void *arg) {
   }
 }
 
+sqlite3 *sqlitegetconn(void) {
+  return conn;
+}