42 #include "SX-book-p.h"
44 #if defined( S_SPLINT_S )
45 #include "splint-defs.h"
48 #define BOOK_TABLE "books"
49 #define TABLE_VERSION 1
53 static gpointer get_root_account_guid( gpointer pObject );
54 static void set_root_account_guid( gpointer pObject, gpointer pValue );
55 static gpointer get_root_template_guid( gpointer pObject );
56 static void set_root_template_guid( gpointer pObject, gpointer pValue );
63 "root_account_guid", CT_GUID, 0,
COL_NNUL, NULL, NULL,
67 "root_template_guid", CT_GUID, 0,
COL_NNUL, NULL, NULL,
76 get_root_account_guid( gpointer pObject )
78 QofBook* book = QOF_BOOK(pObject);
81 g_return_val_if_fail( pObject != NULL, NULL );
82 g_return_val_if_fail( QOF_IS_BOOK(pObject), NULL );
84 root = gnc_book_get_root_account( book );
89 set_root_account_guid( gpointer pObject, gpointer pValue )
91 QofBook* book = QOF_BOOK(pObject);
95 g_return_if_fail( pObject != NULL );
96 g_return_if_fail( QOF_IS_BOOK(pObject) );
97 g_return_if_fail( pValue != NULL );
99 root = gnc_book_get_root_account( book );
100 qof_instance_set_guid( QOF_INSTANCE(root), guid );
104 get_root_template_guid( gpointer pObject )
106 const QofBook* book = QOF_BOOK(pObject);
109 g_return_val_if_fail( pObject != NULL, NULL );
110 g_return_val_if_fail( QOF_IS_BOOK(pObject), NULL );
117 set_root_template_guid( gpointer pObject, gpointer pValue )
119 QofBook* book = QOF_BOOK(pObject);
123 g_return_if_fail( pObject != NULL );
124 g_return_if_fail( QOF_IS_BOOK(pObject) );
125 g_return_if_fail( pValue != NULL );
134 gnc_book_set_template_root( book, root );
136 qof_instance_set_guid( QOF_INSTANCE(root), guid );
145 g_return_if_fail( be != NULL );
146 g_return_if_fail( row != NULL );
156 qof_book_begin_edit( pBook );
159 qof_book_commit_edit( pBook );
161 qof_instance_mark_clean( QOF_INSTANCE(pBook) );
170 g_return_if_fail( be != NULL );
176 gnc_sql_statement_dispose( stmt );
177 if ( result != NULL )
179 GncSqlRow* row = gnc_sql_result_get_first_row( result );
187 (void)gnc_sql_save_book( be, QOF_INSTANCE(be->
book) );
193 load_single_book( be, row );
196 gnc_sql_result_dispose( result );
207 g_return_if_fail( be != NULL );
222 g_return_val_if_fail( be != NULL, FALSE );
223 g_return_val_if_fail( inst != NULL, FALSE );
224 g_return_val_if_fail( QOF_IS_BOOK(inst), FALSE );
233 gnc_sql_init_book_handler(
void )
237 GNC_SQL_BACKEND_VERSION,
void xaccAccountSetType(Account *acc, GNCAccountType tip)
gboolean qof_object_register_backend(QofIdTypeConst type_name, const char *backend_name, gpointer be_data)
const GncGUID * qof_instance_get_guid(gconstpointer)
gint gnc_sql_get_table_version(const GncSqlBackend *be, const gchar *table_name)
#define G_LOG_DOMAIN
Functions providing the SX List as a plugin page.
load and save accounts data to SQL
GncSqlStatement * gnc_sql_create_select_statement(GncSqlBackend *be, const gchar *table_name)
QofBook * qof_book_new(void)
gboolean gnc_sql_create_table(GncSqlBackend *be, const gchar *table_name, gint table_version, const GncSqlColumnTableEntry *col_table)
load and save data to SQL
Account * gnc_book_get_template_root(const QofBook *book)
gpointer(* QofAccessFunc)(gpointer object, const QofParam *param)
const GncGUID * gnc_sql_load_guid(const GncSqlBackend *be, GncSqlRow *row)
Anchor Scheduled Transaction info in a book. See src/doc/books.txt for design overview.
void gnc_sql_slots_load(GncSqlBackend *be, QofInstance *inst)
GncSqlResult * gnc_sql_execute_select_statement(GncSqlBackend *be, GncSqlStatement *stmt)
All type declarations for the whole Gnucash engine.
void gnc_sql_load_object(const GncSqlBackend *be, GncSqlRow *row, QofIdTypeConst obj_name, gpointer pObject, const GncSqlColumnTableEntry *table)
load and save data to SQL
void xaccAccountBeginEdit(Account *acc)
gboolean gnc_sql_commit_standard_item(GncSqlBackend *be, QofInstance *inst, const gchar *tableName, QofIdTypeConst obj_name, const GncSqlColumnTableEntry *col_table)
Account * xaccMallocAccount(QofBook *book)
void xaccAccountCommitEdit(Account *acc)
const gchar * QofLogModule