#ifndef __SQLITE_DB_H
#define __SQLITE_DB_H
-#include <sqlite3.h>
+#include <stdlib.h>
-#ifdef SQLITE_THREADSAFE
-#error cannot use thread safe sqlite, recompile with --enable-threadsafe=no
-#endif
+#include "../sqlite/libsqlite3/sqlite3.h"
typedef struct SQLiteResult {
sqlite3_stmt *r;
char first, final;
+ short flags;
} SQLiteResult;
typedef SQLiteResult SQLiteConn;
typedef int SQLiteModuleIdentifier;
typedef void (*SQLiteQueryHandler)(SQLiteConn *, void *);
-void sqliteasyncqueryf(SQLiteModuleIdentifier identifier, SQLiteQueryHandler handler, void *tag, int flags, char *format, ...);
+void sqliteasyncqueryf(SQLiteModuleIdentifier identifier, SQLiteQueryHandler handler, void *tag, int flags, char *format, ...) __attribute__ ((format (printf, 5, 6)));
+void sqliteasyncqueryfv(int identifier, SQLiteQueryHandler handler, void *tag, int flags, char *format, va_list ap);
int sqliteconnected(void);
int sqlitegetid(void);
void sqlitefreeid(int);
-void sqliteescapestring(char *, char *, unsigned int);
+size_t sqliteescapestring(char *buf, char *src, unsigned int len);
SQLiteResult *sqlitegetresult(SQLiteConn *);
int sqlitefetchrow(SQLiteResult *);
void sqliteattach(char *schema);
void sqlitedetach(char *schema);
-void sqliteloadtable(char *tablename, SQLiteQueryHandler init, SQLiteQueryHandler data, SQLiteQueryHandler fini);
+void sqliteloadtable(char *tablename, SQLiteQueryHandler init, SQLiteQueryHandler data, SQLiteQueryHandler fini, void *tag);
+sqlite3 *sqlitegetconn(void);
#endif