GDA testing
Mark Johnson
mrj001 at shaw.ca
Wed Jan 16 01:38:21 EST 2008
Phil Longstaff wrote:
> Yes, this is the interesting part. Both the GDA and XML backends are
> registered for the file:// url which is what you get when you don't
> supply a URL or if you use the open file dialog. The GDA backend checks
> to see whether it likes the file, and if not, rejects it and the XML
> backend tries it. The logic for this check is basically:
>
> if the path has the ".db" suffix
> try to open the file
>
> it it doesn't exist,
> use the GDA backend to create it
> otherwise
> read the header
> if it has "SQLite format"
> use the GDA backend to create it
> otherwise
> not GDA, try XML
> otherwise (not .db)
> try to open the file
> if it exists
> not GDA, try XML
> otherwise
> use the GDA backend to create it
>
> So, it will only use the GDA backend if one of the following holds:
> a) you supply the .db suffix and the file doesn't exist
> b) you supply the .db suffix and the file exists and has the "SQLite
> format" header
> c) you do not supply the .db suffix and the file doesn't exist
>
> It should skip GDA and use XML if:
> a) you supply the .db suffix and the file exists but doesn't have the
> "SQLite format" header
> b) you don't supply the .db suffix and the file exists
>
> These rules should mean that if you have files gc-data which is an XML
> file and gc-data.db which is an sqlite file, then file://gc-data will
> open the XML file and file://gc-data.db will open the sqlite file.
>
> One other possibility is that the file does exist but it can't open it.
> I just check that fopen(filename,"r") returns NULL. Maybe I should also
> check that if fopen() fails, it fails because the file doesn't exist.
> This evening, I'll check in a change that 1) checks the error status and
> 2) logs the results of the various checks.
>
>
>
I have upgraded gnucash to svn 16866, gda-dev2 branch. I remade a blank
db for gnucash in Postgesql and removed the sqlite .db file that had
been created before.
As before, I started gnucash with the --nofile option.
Simply opening my old xml file has recreated the sqlite .db file in
~/.gnucash/data.
No accounts are displayed. There is an accounts tab open, but it is
empty. In 2.2.3, this would be displaying my accounts.
No progress feedback is displayed in the status bar while opening the
xml file. There was no feedback before; I had neglected to mention this.
Note: today, I have not tried to save with the GDA backend. I'm just
loading my old XML datafile.
This is the content of the gnucash.trace file:
* 22:54:50 CRIT <Gtk> gtk_file_system_unix_get_info: assertion
`g_path_is_absolute (filename)' failed
* 22:55:16 WARN <Gtk> file_system_unix=0x80e48e0 still has
handle=0x8431868 at finalization which is NOT CANCELLED!
I re-did the above and started gnucash as:
$ gnucash --debug --nofile
Here is an excerpt (including the qof_session_load_backend) from the
resulting gnucash.trace:
* 23:11:30 INFO <gnc.commodity> [gnc_commodity_table_insert] insert
0x84856e0 XAG into nsp=0x84567c0 CURRENCY
* 23:11:30 INFO <gnc.backend> [gnc_gda_check_sqlite_file] No '.db',
doesn't exist (errno=2) -> GDA
* 23:11:30 INFO <qof.session> [qof_session_load_backend] selected
GnuCash LibGDA Backend
* 23:11:50 INFO <qof.session> [qof_session_begin] Done running
session_begin on backend
* 23:11:50 INFO <gnc.gui> [gnc_post_file_open]
logpath=/mnt/raid/home/mj/.gnucash/data/books_copy_2008-01-14.xac
* 23:11:50 INFO <gnc.account> [xaccAccountRecomputeBalance] acct=
starting baln=0/1
* 23:11:50 INFO <gnc.commodity> [gnc_commodity_table_insert] insert
0x847eb10 AFA into nsp=0x8543f20 CURRENCY
To test if this is simply a problem with the display of the accounts
tab, I tried a cash flow report. Its options dialog (accounts tab) also
showed an empty display of accounts.
To summarize, I am experiencing two problems:
1. Reading an xml file automatically creates a sqlite file. If I wanted
to use the xml backend, this file should not be created.
2. Reading an xml file fails to read (create in memory? / display) any
accounts.
Mark
More information about the gnucash-devel
mailing list