diff options
Diffstat (limited to 'data.h')
-rw-r--r-- | data.h | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -0,0 +1,47 @@ +#pragma once +#include <sqlite3.h> +#include "list.h" + +/* + * This word into the dictionary + */ +typedef struct word { + int Id; + const unsigned char *Line; +} Word; + +/* + * This is database connection. + */ +typedef struct data { + sqlite3 *db; +} Data; + + +/* + * create a new data struct from sqlite filename. + */ +Data* new_data(const char*); + + +void free_data(Data*); + +/* + * Create the tables. + */ +void bootstrap(Data*); + +/* + * insert line into database. + */ +void insert(Data*, char*); + +/* + * Select all words. + */ +LIST* select(Data*); + +/* + * Print result code from sqlite. + */ +void print_result_code(int error); |