]> git.datanom.net - lensdb.git/blob - src/sqlite-storage.h
Release 0.9.3
[lensdb.git] / src / sqlite-storage.h
1 /*
2 * sqlite-storage.h
3 *
4 * Copyright 2024 Michael Rasmussen <mir@datanom.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22 #ifndef __SQLITE_STORAGE_H__
23 #define __SQLITE_STORAGE_H__
24
25 #ifdef HAVE_CONFIG_H
26 # include <config.h>
27 #endif
28
29 #include <glib.h>
30 #include <glib-object.h>
31 #include <sqlite3.h>
32 #include "csv.h"
33
34 G_BEGIN_DECLS
35
36 typedef struct {
37 gint64 id;
38 gint maker;
39 gchar* sn;
40 gchar* data;
41 gchar* notes;
42 } Row;
43
44 typedef struct {
45 gint64 id;
46 gchar* maker_name;
47 gint page;
48 } Maker;
49
50 gint init_storage(const gchar* path);
51 void close_storage();
52 gint add_lens(Row* row);
53 gint update_lens(const Row* row);
54 gint add_maker(const gchar* maker, gchar** err);
55 gint delete_maker(const gchar* maker, gchar** err);
56 GSList* get_makers();
57 gint get_maker_id(const gchar* maker);
58 Maker* get_maker(gint id);
59 void update_maker(const Maker* maker);
60 void maker_free(Maker* maker);
61 gint delete_lens(const Row* row);
62 GSList* get_lens_by_maker(gint id);
63 GSList* get_lens_by_search(const Row* row);
64 Row* row_new();
65 void row_free(gpointer data, gpointer user_data);
66 void dump_storage(CsvParser* parser);
67
68 G_END_DECLS
69
70 #endif
71
This page took 0.529585 seconds and 6 git commands to generate.