GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-slots-sql.h
Go to the documentation of this file.
1/********************************************************************
2 * gnc-slots-sql.h: load and save data to SQL *
3 * *
4 * This program is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU General Public License as *
6 * published by the Free Software Foundation; either version 2 of *
7 * the License, or (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License*
15 * along with this program; if not, contact: *
16 * *
17 * Free Software Foundation Voice: +1-617-542-5942 *
18 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19 * Boston, MA 02110-1301, USA gnu@gnu.org *
20\********************************************************************/
29#ifndef GNC_SLOTS_SQL_H
30#define GNC_SLOTS_SQL_H
31
32#include <glib.h>
33#include "guid.h"
34#include "qof.h"
35#include "gnc-sql-object-backend.hpp"
36
42{
43public:
45 void load_all(GncSqlBackend*) override { return; }
46 void create_tables(GncSqlBackend*) override;
47 bool commit(GncSqlBackend*, QofInstance*) override { return false; }
48};
49
59gboolean gnc_sql_slots_save (GncSqlBackend* sql_be, const GncGUID* guid,
60 gboolean is_infant, QofInstance* inst);
61
69gboolean gnc_sql_slots_delete (GncSqlBackend* sql_be, const GncGUID* guid);
70
75void gnc_sql_slots_load (GncSqlBackend* sql_be, QofInstance* inst);
76
77typedef QofInstance* (*BookLookupFn) (const GncGUID* guid,
78 const QofBook* book);
79
90 const std::string subquery,
91 BookLookupFn lookup_fn);
92
93void gnc_sql_init_slots_handler (void);
94
95#endif /* GNC_SLOTS_SQL_H */
Main SQL backend structure.
Encapsulates per-class table schema with functions to load, create a table, commit a changed front-en...
Slots are neither loadable nor committable.
void create_tables(GncSqlBackend *) override
Conditionally create or update a database table from m_col_table.
bool commit(GncSqlBackend *, QofInstance *) override
UPDATE/INSERT a single instance of m_type_name into the database.
void load_all(GncSqlBackend *) override
Load all objects of m_type in the database into memory.
void gnc_sql_slots_load(GncSqlBackend *sql_be, QofInstance *inst)
Loads slots for an object from the db.
void gnc_sql_slots_load_for_sql_subquery(GncSqlBackend *sql_be, const std::string subquery, BookLookupFn lookup_fn)
gnc_sql_slots_load_for_sql_subquery - Loads slots for all objects whose guid is supplied by a subquer...
gboolean gnc_sql_slots_save(GncSqlBackend *sql_be, const GncGUID *guid, gboolean is_infant, QofInstance *inst)
gnc_sql_slots_save - Saves slots for an object to the db.
gboolean gnc_sql_slots_delete(GncSqlBackend *sql_be, const GncGUID *guid)
gnc_sql_slots_delete - Deletes slots for an object from the db.
globally unique ID User API
The type used to store guids in C.
Definition guid.h:75
QofBook reference.
Definition qofbook-p.hpp:47