]> git.datanom.net - lensdb.git/blob - src/sqlite-storage.h
Release 0.9.2
[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
33 G_BEGIN_DECLS
34
35 typedef struct {
36 gint64 id;
37 gint maker;
38 gchar* sn;
39 gchar* data;
40 gchar* notes;
41 } Row;
42
43 typedef struct {
44 gint64 id;
45 gchar* maker_name;
46 gint page;
47 } Maker;
48
49 gint init_storage(const gchar* path);
50 void close_storage();
51 gint add_lens(Row* row);
52 gint update_lens(const Row* row);
53 gint add_maker(const gchar* maker, gchar** err);
54 gint delete_maker(const gchar* maker, gchar** err);
55 GSList* get_makers();
56 gint get_maker_id(const gchar* maker);
57 Maker* get_maker(gint id);
58 void update_maker(const Maker* maker);
59 void maker_free(Maker* maker);
60 gint delete_lens(const Row* row);
61 GSList* get_lens_by_maker(gint id);
62 GSList* get_lens_by_search(const Row* row);
63 Row* row_new();
64 void row_free(gpointer data, gpointer user_data);
65
66 G_END_DECLS
67
68 #endif
69
This page took 0.830269 seconds and 6 git commands to generate.