]>
Commit | Line | Data |
---|---|---|
ee8cd7d0 CP |
1 | #ifndef __SQLITE_DB_H |
2 | #define __SQLITE_DB_H | |
3 | ||
4 | #include <sqlite3.h> | |
5 | ||
aa944539 CP |
6 | #ifdef SQLITE_THREADSAFE |
7 | #error cannot use thread safe sqlite, recompile with --enable-threadsafe=no | |
8 | #endif | |
ee8cd7d0 CP |
9 | |
10 | typedef struct SQLiteResult { | |
aa944539 CP |
11 | sqlite3_stmt *r; |
12 | char first, final; | |
ee8cd7d0 CP |
13 | } SQLiteResult; |
14 | ||
aa944539 CP |
15 | typedef SQLiteResult SQLiteConn; |
16 | typedef int SQLiteModuleIdentifier; | |
17 | typedef void (*SQLiteQueryHandler)(SQLiteConn *, void *); | |
18 | ||
ee8cd7d0 CP |
19 | void sqliteasyncqueryf(SQLiteModuleIdentifier identifier, SQLiteQueryHandler handler, void *tag, int flags, char *format, ...); |
20 | ||
21 | int sqliteconnected(void); | |
22 | ||
008e57e5 CP |
23 | int sqlitegetid(void); |
24 | void sqlitefreeid(int); | |
ee8cd7d0 CP |
25 | |
26 | void sqliteescapestring(char *, char *, unsigned int); | |
27 | ||
28 | SQLiteResult *sqlitegetresult(SQLiteConn *); | |
29 | int sqlitefetchrow(SQLiteResult *); | |
30 | void sqliteclear(SQLiteResult *); | |
31 | ||
32 | int sqlitequerysuccessful(SQLiteResult *); | |
33 | ||
34 | #define sqlitegetvalue(result, column) (char *)sqlite3_column_text(result->r, column) | |
35 | ||
aa944539 CP |
36 | void sqliteattach(char *schema); |
37 | void sqlitedetach(char *schema); | |
ee8cd7d0 CP |
38 | void sqliteloadtable(char *tablename, SQLiteQueryHandler init, SQLiteQueryHandler data, SQLiteQueryHandler fini); |
39 | ||
40 | #endif |