]> git.datanom.net - gtk_lensdatabase.git/blob - src/sqlite-storage.h
On the way
[gtk_lensdatabase.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 gchar* storage_get_path();
52 void close_storage();
53 gint add_lens(Row* row);
54 gint update_lens(const Row* row);
55 gint update_lens_maker(const Row* row);
56 gint add_maker(const gchar* maker, gchar** err);
57 gint delete_maker(const gchar* maker, gchar** err);
58 GSList* get_makers();
59 gint get_maker_id(const gchar* maker);
60 Maker* get_maker(gint id);
61 void update_maker(const Maker* maker);
62 void maker_free(Maker* maker);
63 gint delete_lens(const Row* row);
64 GSList* get_lens_by_maker(gint id);
65 GSList* get_lens_by_search(const Row* row);
66 Row* row_new();
67 void row_free(gpointer data, gpointer user_data);
68 void dump_storage(CsvParser* parser);
69
70 G_END_DECLS
71
72 #endif
73
This page took 0.509232 seconds and 6 git commands to generate.