r20154 - gnucash/trunk/src/backend/sql - Throw an error and return if if the book is marked readonly.
John Ralls
jralls at code.gnucash.org
Sun Jan 23 12:35:31 EST 2011
Author: jralls
Date: 2011-01-23 12:35:31 -0500 (Sun, 23 Jan 2011)
New Revision: 20154
Trac: http://svn.gnucash.org/trac/changeset/20154
Modified:
gnucash/trunk/src/backend/sql/gnc-backend-sql.c
Log:
Throw an error and return if if the book is marked readonly.
Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.c 2011-01-23 17:31:28 UTC (rev 20153)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.c 2011-01-23 17:35:31 UTC (rev 20154)
@@ -603,6 +603,12 @@
g_return_if_fail( be != NULL );
g_return_if_fail( inst != NULL );
+ if ( qof_book_is_readonly( be->primary_book ) )
+ {
+ qof_backend_set_error( (QofBackend*)be, ERR_BACKEND_READONLY );
+ (void)gnc_sql_connection_rollback_transaction( be->conn );
+ return;
+ }
/* During initial load where objects are being created, don't commit
anything, but do mark the object as clean. */
if ( be->loading )
@@ -647,7 +653,7 @@
be_data.inst = inst;
be_data.is_ok = TRUE;
/* Set/update the application version in the database */
- if (gnc_sql_get_table_version( be, "Gnucash") != gnc_version )
+ if ( gnc_sql_get_table_version( be, "Gnucash") != gnc_version )
gnc_sql_set_table_version( be, "Gnucash", gnc_version );
qof_object_foreach_backend( GNC_SQL_BACKEND, commit_cb, &be_data );
More information about the gnucash-changes
mailing list