Branch data Line data Source code
1 : : /********************************************************************
2 : : * gnc-transaction-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 : : \********************************************************************/
21 : : /** @file gnc-transaction-sql.h
22 : : * @brief load and save data to SQL
23 : : * @author Copyright (c) 2006-2008 Phil Longstaff <plongstaff@rogers.com>
24 : : *
25 : : * This file implements the top-level QofBackend API for saving/
26 : : * restoring data to/from an SQL database
27 : : */
28 : :
29 : : #ifndef GNC_TRANSACTION_SQL_H
30 : : #define GNC_TRANSACTION_SQL_H
31 : :
32 : : #include "Transaction.h"
33 : : #include "qof.h"
34 : : #include "Account.h"
35 : :
36 : : class GncSqlTransBackend : public GncSqlObjectBackend
37 : : {
38 : : public:
39 : : GncSqlTransBackend();
40 : : void load_all(GncSqlBackend*) override;
41 : : void create_tables(GncSqlBackend*) override;
42 : : bool commit (GncSqlBackend* sql_be, QofInstance* inst) override;
43 : : };
44 : :
45 : : class GncSqlSplitBackend : public GncSqlObjectBackend
46 : : {
47 : : public:
48 : : GncSqlSplitBackend();
49 : 5 : void load_all(GncSqlBackend*) override { return; } // loaded by transaction.
50 : : void create_tables(GncSqlBackend*) override;
51 : : bool commit (GncSqlBackend* sql_be, QofInstance* inst) override;
52 : : };
53 : :
54 : : /**
55 : : * Loads all transactions which have splits for a specific account.
56 : : *
57 : : * @param sql_be SQL backend
58 : : * @param account Account
59 : : */
60 : : void gnc_sql_transaction_load_tx_for_account (GncSqlBackend* sql_be,
61 : : Account* account);
62 : : typedef struct
63 : : {
64 : : Account* acct;
65 : : gnc_numeric balance;
66 : : gnc_numeric cleared_balance;
67 : : gnc_numeric reconciled_balance;
68 : : } acct_balances_t;
69 : :
70 : :
71 : : #endif /* GNC_TRANSACTION_SQL_H */
|