]> git.ozlabs.org Git - ccan/blob - tools/_infotojson/database.h
Revised version of infotojson after comments
[ccan] / tools / _infotojson / database.h
1 /* Simple SQL-style database ops.  Currently implemented for sqlite3. */
2 #include <stdbool.h>
3
4 /* Returns handle to the database.. */
5 void *db_open(const char *file);
6
7 /* Runs query (SELECT).  Fills in columns. */
8 struct db_query
9 {
10         unsigned int num_rows;
11         char ***rows;
12 };
13
14 struct db_query *db_query(void *h, const char *query);
15
16 /* Runs command (CREATE TABLE/INSERT) */
17 void db_command(void *h, const char *command);
18
19 /* Closes database (only called when everything OK). */
20 void db_close(void *h);