Bug 632166: gnc_backend_sql_sync_all: Commit only if all operations were successful; otherwise roll back.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19682 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls
2010-10-19 22:42:43 +00:00
parent 5ce7dc5383
commit 917b516ead
+11 -6
View File
@@ -519,13 +519,18 @@ gnc_sql_sync_all( GncSqlBackend* be, /*@ dependent @*/ QofBook *book )
{
qof_object_foreach_backend( GNC_SQL_BACKEND, write_cb, be );
}
if ( is_ok )
{
(void)gnc_sql_connection_commit_transaction( be->conn );
be->is_pristine_db = FALSE;
(void)gnc_sql_connection_commit_transaction( be->conn );
be->is_pristine_db = FALSE;
// Mark the book as clean
qof_book_mark_saved( book );
// Mark the book as clean
qof_book_mark_saved( book );
}
else
{
gnc_sql_connection_rollback_transaction( be->conn );
}
LEAVE( "book=%p", book );
}