]>
Commit | Line | Data |
---|---|---|
ee8cd7d0 CP |
1 | #ifndef __SQLITE_DB_H |
2 | #define __SQLITE_DB_H | |
3 | ||
adf9e9ea CP |
4 | #include <stdlib.h> |
5 | ||
05a1e63f | 6 | #include "../sqlite/libsqlite3/sqlite3.h" |
ee8cd7d0 CP |
7 | |
8 | typedef struct SQLiteResult { | |
aa944539 CP |
9 | sqlite3_stmt *r; |
10 | char first, final; | |
ee8cd7d0 CP |
11 | } SQLiteResult; |
12 | ||
aa944539 CP |
13 | typedef SQLiteResult SQLiteConn; |
14 | typedef int SQLiteModuleIdentifier; | |
15 | typedef void (*SQLiteQueryHandler)(SQLiteConn *, void *); | |
16 | ||
bb4b25ee | 17 | void sqliteasyncqueryf(SQLiteModuleIdentifier identifier, SQLiteQueryHandler handler, void *tag, int flags, char *format, ...) __attribute__ ((format (printf, 5, 6))); |
91ad51f6 | 18 | void sqliteasyncqueryfv(int identifier, SQLiteQueryHandler handler, void *tag, int flags, char *format, va_list ap); |
ee8cd7d0 CP |
19 | |
20 | int sqliteconnected(void); | |
21 | ||
008e57e5 CP |
22 | int sqlitegetid(void); |
23 | void sqlitefreeid(int); | |
ee8cd7d0 | 24 | |
404d307c | 25 | size_t sqliteescapestring(char *buf, char *src, unsigned int len); |
ee8cd7d0 CP |
26 | |
27 | SQLiteResult *sqlitegetresult(SQLiteConn *); | |
28 | int sqlitefetchrow(SQLiteResult *); | |
29 | void sqliteclear(SQLiteResult *); | |
30 | ||
31 | int sqlitequerysuccessful(SQLiteResult *); | |
32 | ||
df196dd2 | 33 | #define sqlitegetvalue(result, column) ((char *)sqlite3_column_text(result->r, column)) |
ee8cd7d0 | 34 | |
aa944539 CP |
35 | void sqliteattach(char *schema); |
36 | void sqlitedetach(char *schema); | |
91ad51f6 | 37 | void sqliteloadtable(char *tablename, SQLiteQueryHandler init, SQLiteQueryHandler data, SQLiteQueryHandler fini, void *tag); |
ee8cd7d0 CP |
38 | |
39 | #endif |