summaryrefslogtreecommitdiff
path: root/src/dbhandling.h
blob: fd215791cceb7f86c5436aa9c09148d43eac57f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef _DBHANDLING_
#define _DBHANDLING_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sqlite3.h>

#include "enum.h"

#define MAX_NAME_LEN 128
#define MAX_AUTHOR_LEN 64
#define MAX_VALUE_LEN 16
#define MAX_STATUS_LEN 16

typedef struct {
    char *name;
    char *author;
    char *value;
    char *status;
} entry_t;


void exit_with_error(sqlite3 *db, const char *msg);
void select_from_table(sqlite3 *db, args_e target, entry_t *entry);
void update_entry(sqlite3 *db, args_e target, entry_t *entry);
void add_entry(sqlite3 *db, args_e target, entry_t *entry);

#endif