]>
Commit | Line | Data |
---|---|---|
1 | #ifndef __SQLITE_DB_H | |
2 | #define __SQLITE_DB_H | |
3 | ||
4 | #include <stdlib.h> | |
5 | ||
6 | #include "../sqlite/libsqlite3/sqlite3.h" | |
7 | ||
8 | typedef struct SQLiteResult { | |
9 | sqlite3_stmt *r; | |
10 | char first, final; | |
11 | short flags; | |
12 | } SQLiteResult; | |
13 | ||
14 | typedef SQLiteResult SQLiteConn; | |
15 | typedef int SQLiteModuleIdentifier; | |
16 | typedef void (*SQLiteQueryHandler)(SQLiteConn *, void *); | |
17 | ||
18 | void sqliteasyncqueryf(SQLiteModuleIdentifier identifier, SQLiteQueryHandler handler, void *tag, int flags, char *format, ...) __attribute__ ((format (printf, 5, 6))); | |
19 | void sqliteasyncqueryfv(int identifier, SQLiteQueryHandler handler, void *tag, int flags, char *format, va_list ap); | |
20 | ||
21 | int sqliteconnected(void); | |
22 | ||
23 | int sqlitegetid(void); | |
24 | void sqlitefreeid(int); | |
25 | ||
26 | size_t sqliteescapestring(char *buf, char *src, unsigned int len); | |
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 | ||
36 | void sqliteattach(char *schema); | |
37 | void sqlitedetach(char *schema); | |
38 | void sqliteloadtable(char *tablename, SQLiteQueryHandler init, SQLiteQueryHandler data, SQLiteQueryHandler fini, void *tag); | |
39 | sqlite3 *sqlitegetconn(void); | |
40 | ||
41 | #endif |