1
/********************************************************************\
2
* PostgresBackend.h -- implements postgres backend *
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. *
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. *
14
* You should have received a copy of the GNU General Public License*
15
* along with this program; if not, contact: *
17
* Free Software Foundation Voice: +1-617-542-5942 *
18
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
19
* Boston, MA 02111-1307, USA gnu@gnu.org *
20
\********************************************************************/
27
* Implements the callbacks for the postgres backend.
30
* Copyright (c) 2000, 2001 Linas Vepstas
34
#ifndef __POSTGRES_BACKEND_H__
35
#define __POSTGRES_BACKEND_H__
41
#include "Transaction.h"
46
typedef struct _pgend PGBackend;
56
#define MAX_VERSION_AGE 10
62
AccessMode session_mode;
64
char session_guid_str[GUID_ENCODING_LENGTH+1];
66
/* sql query compiler */
69
/* postgres-specific connection data */
75
gboolean freshly_created_db;
76
gboolean freshly_created_prdb;
78
/* counter used to nest callback disables */
80
/* callback hooks are saved in snr during disables */
83
/* my postgres backend pid, used for telling apart notifies */
94
Timespec last_account;
96
Timespec last_transaction;
98
guint32 version_check; /* data aging timestamp */
100
/* scratch space for constructing queries */
103
int nrows; /* number of rows in query result */
110
/* enginge data caches -- not used anywhere except in session_end */
111
AccountGroup *topgroup;
115
* pgendNew creates a new postgress backend
117
Backend * pgendNew (void);
119
void pgendDisable (PGBackend *be);
120
void pgendEnable (PGBackend *be);
122
void pgendStoreOneTransactionOnly (PGBackend *be, Transaction *ptr, sqlBuild_QType update);
124
void pgendPutOneAccountOnly (PGBackend *be, Account *ptr);
125
void pgendPutOneCommodityOnly (PGBackend *be, gnc_commodity *ptr);
126
void pgendPutOnePriceOnly (PGBackend *be, GNCPrice *ptr);
127
void pgendPutOneSplitOnly (PGBackend *be, Split *ptr);
128
void pgendPutOneTransactionOnly (PGBackend *be, Transaction *ptr);
130
int pgendAccountCompareVersion (PGBackend *be, Account *ptr);
131
int pgendPriceCompareVersion (PGBackend *be, GNCPrice *ptr);
132
int pgendTransactionCompareVersion (PGBackend *be, Transaction *ptr);
134
void pgendStoreAuditAccount (PGBackend *be, Account *ptr, sqlBuild_QType update);
135
void pgendStoreAuditPrice (PGBackend *be, GNCPrice *ptr, sqlBuild_QType update);
136
void pgendStoreAuditSplit (PGBackend *be, Split *ptr, sqlBuild_QType update);
137
void pgendStoreAuditTransaction (PGBackend *be, Transaction *ptr, sqlBuild_QType update);
139
int pgendTransactionGetDeletedVersion (PGBackend *be, Transaction *ptr);
141
#endif /* __POSTGRES_BACKEND_H__ */