GnuCash c935c2f+
Loading...
Searching...
No Matches
sqlite3test.c
1/********************************************************************\
2 * This program is free software; you can redistribute it and/or *
3 * modify it under the terms of the GNU General Public License as *
4 * published by the Free Software Foundation; either version 2 of *
5 * the License, or (at your option) any later version. *
6 * *
7 * This program is distributed in the hope that it will be useful, *
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
10 * GNU General Public License for more details. *
11 * *
12 * You should have received a copy of the GNU General Public License*
13 * along with this program; if not, contact: *
14 * *
15 * Free Software Foundation Voice: +1-617-542-5942 *
16 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
17 * Boston, MA 02110-1301, USA gnu@gnu.org *
18 * *
19\********************************************************************/
20
21#include <config.h>
22#include "qofsession.h"
23#define TESTFILE "/tmp/blah.gnucash"
24int main()
25{
26 const char* testurl = "sqlite3://" TESTFILE;
27 char * no_args[1] = { NULL };
28 QofSession* s = NULL;
29
31 qof_init();
32 gnc_engine_init(0, no_args);
33
34 s = qof_session_new(NULL);
36 qof_session_load(s, NULL);
37 qof_session_save(s, NULL);
39 qof_session_destroy(s);
40 unlink(TESTFILE);
41 return 0;
42}
void qof_session_save(QofSession *session, QofPercentageFunc percentage_func)
The qof_session_save() method will commit all changes that have been made to the session.
void qof_session_end(QofSession *session)
The qof_session_end() method will release the session lock.
void qof_session_begin(QofSession *session, const char *uri, SessionOpenMode mode)
Begins a new session.
@ SESSION_NEW_STORE
Open will fail if the URI doesn't exist or is locked.
Definition qofsession.h:124
void gnc_engine_init(int argc, char **argv)
PROTOTYPES.
void qof_log_init(void)
Initialize the error logging subsystem.
Definition qoflog.cpp:156
void qof_init(void)
Initialise the Query Object Framework.
Definition qofutil.cpp:259
Encapsulates a connection to a backend (persistent store)