Loading transactions from sql db at startup
Phil Longstaff
plongstaff at rogers.com
Thu Nov 19 20:49:16 EST 2009
Currently, transactions/splits are not loaded from an sqlite3/mysql/postgres
db at startup in the 2.3.X series. I think I need to change this so that it
does load all transactions/splits. As has been pointed out many times,
gnucash is *not* a database app. When it acts more like a database app, we
can restore this behavior.
There are a number of bugs which can be attributed to this current behavior:
1) the account function to get the balance as of a certain date assumes that
all splits are loaded. It find the last split on or before the date and
returns its running balance value. That is the cause of
https://bugzilla.gnome.org/show_bug.cgi?id=591098 - "present" and all other
columns except TOTAL are zero until you open the account and read in all of
the splits.
2) https://bugzilla.gnome.org/show_bug.cgi?id=598618 (does not calculate
account balances correctly). When gnucash starts with an sql db, when the
accounts are loaded, an SQL query is also run to calculate the final balance
for all accounts. This value is set as the starting balance so that the final
balance appears correctly in the account list. As transactions are loaded
(e.g. because an account is opened), for each account, the final balance is
compared both before and after the transactions are loaded, and for any
accounts that have changed (i.e. there are new splits loaded for the account),
the starting balance is adjusted so that the end balance is unchanged.
However, this uses the function xaccAccountRecomputeBalance() which has some
restrictions (does nothing if account is being edited, for example).
Until we change gnucash to properly use the data as a database, I think the
best solution is to load all of the data on startup.
Phil
More information about the gnucash-devel
mailing list