database.h 500 B

1234567891011121314151617181920
  1. /* Simple SQL-style database ops. Currently implemented for sqlite3. */
  2. #include <stdbool.h>
  3. /* Returns handle to the database.. */
  4. void *db_open(const char *file);
  5. /* Runs query (SELECT). Fills in columns. */
  6. struct db_query
  7. {
  8. unsigned int num_rows;
  9. char ***rows;
  10. };
  11. struct db_query *db_query(void *h, const char *query);
  12. /* Runs command (CREATE TABLE/INSERT) */
  13. void db_command(void *h, const char *command);
  14. /* Closes database (only called when everything OK). */
  15. void db_close(void *h);