diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-02-12 13:34:56 +0100 |
---|---|---|
committer | Gabriel A. Giovanini <g.giovanini@gridx.de> | 2024-02-14 12:29:25 +0100 |
commit | fc26d6542276e17f3206a00b996162397d875e93 (patch) | |
tree | 755683100beb190eb8c5983d77fdbdc041f20647 /data.h | |
download | dict-fc26d6542276e17f3206a00b996162397d875e93.tar.gz dict-fc26d6542276e17f3206a00b996162397d875e93.tar.bz2 dict-fc26d6542276e17f3206a00b996162397d875e93.zip |
feat: Initial commit
Add initial code form dealing with sqlite.
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); |