1#pragma once
2#include <sqlite3.h>
3#include "list.h"
4
5/*
6 * This word into the dictionary
7 */
8typedef struct word
9{
10 int Id;
11 const unsigned char *Line;
12} Word;
13
14/*
15 * This is database connection.
16 */
17typedef struct data
18{
19 sqlite3 *db;
20} Data;
21
22/*
23 * create a new data struct from sqlite filename.
24 */
25Data* new_data(const char*);
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*, int);
38
39/*
40 * Select all words.
41 */
42LIST* data_select(Data*, char*, int, int);
43
44/*
45 * Print result code from sqlite.
46 */
47void print_result_code(int error);