]> git.ozlabs.org Git - ccan/blob - tools/_infotojson/database.h
7081df43e9981a7bc0aebcea97c5d37dbbd5a0f0
[ccan] / tools / _infotojson / database.h
1 /* Simple SQL-style database ops.  Currently implemented for sqlite3. */
2 //#ifndef _UPLOAD_ANALYSIS_DATABASE_H
3 //#define _UPLOAD_ANALYSIS_DATABASE_H
4 #include <stdbool.h>
5
6 /* Returns handle to the database.. */
7 void *db_open(const char *file);
8
9 /* Runs query (SELECT).  Fills in columns. */
10 struct db_query
11 {
12         unsigned int num_rows;
13         char ***rows;
14 };
15
16 struct db_query *db_query(void *h, const char *query);
17
18 /* Runs command (CREATE TABLE/INSERT) */
19 void db_command(void *h, const char *command);
20
21 /* Starts transaction.  Doesn't need to nest. */
22 //void db_transaction_start(void *h);
23
24 /* Finishes transaction, or rolls it back and caller needs to start again. */
25 //bool db_transaction_finish(void *h);
26
27 /* Closes database (only called when everything OK). */
28 void db_close(void *h);
29
30 //#endif /* _UPLOAD_ANALYSIS_DATABASE_H */