GnuCash  5.6-150-g038405b370+
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"
24 int main()
25 {
26  const char* testurl = "sqlite3://" TESTFILE;
27  char * no_args[1] = { NULL };
28  QofSession* s = NULL;
29 
30  qof_log_init();
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);
38  qof_session_end(s);
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.
Definition: qofsession.cpp:625
Encapsulates a connection to a backend (persistent store)
void qof_session_begin(QofSession *session, const char *uri, SessionOpenMode mode)
Begins a new session.
Definition: qofsession.cpp:610
void qof_log_init(void)
Initialize the error logging subsystem.
Definition: qoflog.cpp:156
void gnc_engine_init(int argc, char **argv)
PROTOTYPES.
Definition: gnc-engine.cpp:116
void qof_session_end(QofSession *session)
The qof_session_end() method will release the session lock.
Definition: qofsession.cpp:647
void qof_init(void)
Initialise the Query Object Framework.
Definition: qofutil.cpp:259
Open will fail if the URI doesn&#39;t exist or is locked.
Definition: qofsession.h:124