1#pragma once
2#include <sqlite3.h>
3#include "list.h"
4
5/*
6 * This word into the dictionary
7 */
8typedef struct word {
9 int Id;
10 const unsigned char *Line;
11} Word;
12
13/*
14 * This is database connection.
15 */
16typedef struct data {
17 sqlite3 *db;
18} Data;
19
20
21/*
22 * create a new data struct from sqlite filename.
23 */
24Data* new_data(const char*);
25
26
27void free_data(Data*);
28
29/*
30 * Create the tables.
31 */
32void bootstrap(Data*);
33
34/*
35 * insert line into database.
36 */
37void insert(Data*, char*);
38
39/*
40 * Select all words.
41 */
42LIST* select(Data*);
43
44/*
45 * Print result code from sqlite.
46 */
47void print_result_code(int error);