r19798 - gnucash/trunk/src - Bug 634392: New sql database raises clobber warning

John Ralls jralls at code.gnucash.org
Thu Nov 11 01:12:20 EST 2010


Author: jralls
Date: 2010-11-11 01:12:20 -0500 (Thu, 11 Nov 2010)
New Revision: 19798
Trac: http://svn.gnucash.org/trac/changeset/19798

Modified:
   gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
   gnucash/trunk/src/backend/dbi/test/test-dbi-business-stuff.c
   gnucash/trunk/src/backend/dbi/test/test-dbi-stuff.c
   gnucash/trunk/src/backend/dbi/test/test-dbi.c
   gnucash/trunk/src/backend/xml/gnc-backend-xml.c
   gnucash/trunk/src/backend/xml/test/test-load-xml2.c
   gnucash/trunk/src/backend/xml/test/test-save-in-lang.c
   gnucash/trunk/src/bin/gnucash-bin.c
   gnucash/trunk/src/business/business-core/test/test-customer.c
   gnucash/trunk/src/business/business-core/test/test-employee.c
   gnucash/trunk/src/business/business-core/test/test-job.c
   gnucash/trunk/src/business/business-core/test/test-vendor.c
   gnucash/trunk/src/engine/test/test-recursive.c
   gnucash/trunk/src/gnome-utils/druid-gnc-xml-import.c
   gnucash/trunk/src/gnome-utils/gnc-file.c
   gnucash/trunk/src/libqof/qof/qofbackend-p.h
   gnucash/trunk/src/libqof/qof/qofbackend.h
   gnucash/trunk/src/libqof/qof/qofsession.c
   gnucash/trunk/src/libqof/qof/qofsession.h
Log:
Bug 634392: New sql database raises clobber warning

A fairly extensive change, because I changed may_clobber from a global 
qof function (which passed through qofbackend and fetched up in the 
actual backends) to a local static in the individual backends which 
raise a new qof_backend_error, QOF_ABCKEND_STORE_EXISTS. This was 
necessary to reorder the existence check before the lock, because with 
the sql backends, locking creates the database... which then would 
return may_clobber as true, even though it really wasn't.

New parameter "force" added to session_begin() functions, and 
"create_if_nonexistant" is renamed to simply "create". The reason for 
the latter is that the file/database is created regardless of whether it 
already exists; that's what the clobber check is about. The new "force" 
parameter is set to true the second time through, after the user has 
responded to the clobber dialog indicating that the data should be 
destroyed.

Many of the extraneous changes are just adding the new parameter to the 
session_begin() calls.

gnc-file changes to handle the error in favor of calling the 
no-longer-existing qof_check_may_clobber_data() call after 
session_begin().

Two minor changes to gnc_file_do_save_as: gnc_add_history and 
gnc_hook_run are now called on new_session instead of old_session; this 
ensures that the new file/database is used at the next startup of 
gnucash. Second, the filename/url is filtered before displaying the 
"may_clobber" dialog box to prevent displaying plaintext database 
passwords.





More information about the gnucash-patches mailing list