gnucash stable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Mon Dec 23 16:18:52 EST 2024
Updated via https://github.com/Gnucash/gnucash/commit/c549e203 (commit)
via https://github.com/Gnucash/gnucash/commit/bda17ff4 (commit)
from https://github.com/Gnucash/gnucash/commit/579eed1f (commit)
commit c549e203cba837584059984b3e199f3929590156
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Dec 23 12:59:11 2024 -0800
Bug 799449 - Save As... sequence from SQL to XML format does not...
clear lock on the origin SQL book.
GncDbiSqlConnection::unlock_database function errored out if the last
dbi interaction resulted in an error, even if it was a harmless index
out of range. Ignore index out of range errors.
diff --git a/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp b/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
index 7b4e85fdb6..d1b8626a2a 100644
--- a/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
+++ b/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
@@ -173,7 +173,8 @@ GncDbiSqlConnection::unlock_database ()
{
if (m_conn == nullptr) return;
if (m_readonly) return;
- g_return_if_fail (dbi_conn_error (m_conn, nullptr) == 0);
+ auto dbi_error{dbi_conn_error (m_conn, nullptr)};
+ g_return_if_fail (dbi_error == DBI_ERROR_NONE || dbi_error == DBI_ERROR_BADIDX);
auto tables = m_provider->get_table_list (m_conn, lock_table);
if (tables.empty())
commit bda17ff4d8d66711926ef4870866799880120b06
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Dec 17 16:23:13 2024 -0800
Bug 799487 - Unable to save gnucash DB file as XML file
Not quite true, it just takes a really long time for a large database.
The underlying problem is gnc_file_do_save_as reloads the data to make
sure that the save-as saves everything. On the SQL backend that
triggers a scrub. The scrub itseld doesn't take long, but every
transaction commit was logged in the transaction log and did a refresh
of the registers. So:
* Suspend logging while doing the scrub.
* Suspend UI refreshes and QOF events while reloading the data.
diff --git a/gnucash/gnome-utils/gnc-file.c b/gnucash/gnome-utils/gnc-file.c
index cea2cc7f44..489f6bb52a 100644
--- a/gnucash/gnome-utils/gnc-file.c
+++ b/gnucash/gnome-utils/gnc-file.c
@@ -1593,8 +1593,12 @@ gnc_file_do_save_as (GtkWindow *parent, const char* filename)
}
/* Make sure all of the data from the old file is loaded */
+ qof_event_suspend ();
+ gnc_suspend_gui_refresh ();
qof_session_ensure_all_data_loaded(session);
-
+ gnc_resume_gui_refresh ();
+ qof_event_resume ();
+
/* -- this session code is NOT identical in FileOpen and FileSaveAs -- */
save_in_progress++;
diff --git a/libgnucash/backend/sql/gnc-sql-backend.cpp b/libgnucash/backend/sql/gnc-sql-backend.cpp
index 49a040582c..0bf222bc5f 100644
--- a/libgnucash/backend/sql/gnc-sql-backend.cpp
+++ b/libgnucash/backend/sql/gnc-sql-backend.cpp
@@ -30,6 +30,7 @@
#include <gncTaxTable.h>
#include <gncInvoice.h>
#include <gnc-pricedb.h>
+#include <TransLog.h>
#include <algorithm>
#include <cassert>
@@ -347,8 +348,10 @@ GncSqlBackend::load (QofBook* book, QofBackendLoadType loadType)
* m_loading true prevents changes from being written back to the
* database. Do that now.
*/
+ xaccLogDisable();
auto transactions = qof_book_get_collection (book, GNC_ID_TRANS);
qof_collection_foreach(transactions, scrub_txn_callback, nullptr);
+ xaccLogEnable();
/* Mark the session as clean -- though it should never be marked
* dirty with this backend
Summary of changes:
gnucash/gnome-utils/gnc-file.c | 6 +++++-
libgnucash/backend/dbi/gnc-dbisqlconnection.cpp | 3 ++-
libgnucash/backend/sql/gnc-sql-backend.cpp | 3 +++
3 files changed, 10 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list