GDA testing

Phil Longstaff plongstaff at rogers.com
Tue Jan 15 13:24:15 EST 2008


Mark Johnson wrote:
> Mark Johnson wrote:
>> In response to your latest e-mail, here is the excerpt from 
>> /tmp/gnucash.trace:
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8452c70 VND into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8452d88 YER into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8452d28 YUM into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8451b20 ZMK into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8451be0 ZWD into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8451b58 XDR into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x844e620 XXX into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8451d78 XAU into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8451e90 XPD into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8451e40 XPT into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8451f48 XAG into nsp=0x8260fa0 CURRENCY
>> * 22:17:29  INFO <qof.session> [qof_session_load_backend]  selected 
>> GnuCash LibGDA Backend
>> * 22:17:50  INFO <qof.session> [qof_session_begin] Done running 
>> session_begin on backend
>> * 22:17:50  INFO <gnc.gui> [gnc_post_file_open] 
>> logpath=/mnt/raid/home/mj/.gnucash/data/books_copy_2008-01-14.xac
>> * 22:17:50  INFO <gnc.account> [xaccAccountRecomputeBalance] acct= 
>> starting baln=0/1
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x845d2d0 AFA into nsp=0x8649440 CURRENCY
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8458468 AFN into nsp=0x8649440 CURRENCY
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x84561e8 ALL into nsp=0x8649440 CURRENCY
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x844d028 DZD into nsp=0x8649440 CURRENCY
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x845b160 ADF into nsp=0x8649440 CURRENCY
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x84460b0 ADP into nsp=0x8649440 CURRENCY
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x843f490 AON into nsp=0x8649440 CURRENCY
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x845b3e8 ARA into nsp=0x8649440 CURRENCY
>> * 22:17:50  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
>> 0x8444098 ARS into nsp=0x8649440 CURRENCY
>>
>> The qof_session_load_backend did not appear in the file until after I 
>> tried to open the xml file (using File->Open).  The lines before and 
>> after this excerpt seem to be much more of the same - loading 
>> commodities.
>>

Yes, it likes loading commodities.  It does it 4 times.
>>   
> Apologies for replying to myself.  Why does the above say 
> "selectedGnuCash LibGDA Backend" when I simply loaded an xml file?

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.

>
> It occurred to me that saving to the GDA backend might produce another 
> call to qof_session_load_backend.  Since I am not sure which one would 
> be of interest, I ran it again.  This time, there was a second call to 
> qof_session_load_backend.  Here is the context of the second call from 
> the second run (presumably when I selected File ->@gnucashpgsql82x to 
> save to GDA).  (The Postgresql database was freshly created without 
> tables prior to the run.)
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x85b70c0 YUM into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x85bd640 ZMK into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x84a5ec8 ZWD into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x85687d0 XDR into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x8442600 XXX into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x845e3d0 XAU into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x846aee8 XPD into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x8473458 XPT into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x8562d18 XAG into nsp=0x85a4320 CURRENCY
> * 23:49:39  INFO <qof.session> [qof_session_load_backend]  selected 
> GnuCash LibGDA Backend
> * 23:49:53  INFO <qof.session> [qof_session_begin] Done running 
> session_begin on backend
> * 23:49:53  INFO <gnc.gui> [gnc_post_file_open] 
> logpath=/mnt/raid/home/mj/.gnucash/data/gda:,, at gnucashpgsql82x
> * 23:49:53  INFO <gnc.account> [xaccAccountRecomputeBalance] acct= 
> starting baln=0/1
> * 23:49:53  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x8464680 AFA into nsp=0x86fde40 CURRENCY
> * 23:49:53  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x854c538 AFN into nsp=0x86fde40 CURRENCY
> * 23:49:53  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x848a758 ALL into nsp=0x86fde40 CURRENCY
> * 23:49:53  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x854c0e8 DZD into nsp=0x86fde40 CURRENCY
> * 23:49:53  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x855e270 ADF into nsp=0x86fde40 CURRENCY
> * 23:49:53  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x84f3f00 ADP into nsp=0x86fde40 CURRENCY
> * 23:49:53  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x8569298 AON into nsp=0x86fde40 CURRENCY
> * 23:49:53  INFO <gnc.commodity> [gnc_commodity_table_insert] insert 
> 0x84a86e8 ARA into nsp=0x86fde40 CURRENCY
>
>
> Again, tables were created in the Postgresql db, but no data were 
> saved.  I checked the accounts table, and it had zero rows.
>
> Here's something else I noticed:
> 1. One still gets the modal dialog asking about auto-saving the data 
> every few minutes.  I expect that the GDA backend saves the data as it 
> is entered, and that this dialog should not appear.
> 2. This modal dialog appeared beneath other windows including the 
> gnucash main window.  That made me think, for a moment, that gnucash 
> had locked up.  A quick alt-tab through the windows revealed the modal 
> dialog.
>

I'm not sure why you're getting the modal dialog.  I don't know what 
state gnucash was in.  Yes, it is a problem if it appears under other 
windows.

Phil



More information about the gnucash-devel mailing list