QOF 2-part commit

Derek Atkins warlord at MIT.EDU
Tue Jun 23 08:56:37 EDT 2009

Phil Longstaff <plongstaff at rogers.com> writes:

> With the SQL backend, the date-entered for transactions is being save as jan 1 
> 1970.  The problem is with the 2-part commit.
> xaccTransCommitEdit() calls qof_commit_edit() (1st part), then sets date-
> entered to the current time, then calls qof_commit_edit_part2() (2nd part).  
> However, since the transaction is marked clean during the 1st part, and not 
> marked dirty again, the 2nd part does nothing, so the date-entered is not set 
> in the db.
> Is the 2-part commit meant to implement the standard 2-phase commit for a db?  
> If not, what is the purpose?

Well, according to the docs for those two functions:

 * commit_edit helpers
 * The caller should call PART1 as the first thing, then 
 * perform any local operations prior to calling the backend.
 * Then call PART2.  

 * part1 -- deal with the editlevel

 * part2 -- deal with the backend

They are separated because there were local operations that had to
happen for various objects between the two portions..  But I don't
recall anymore why the separation -- it's been nearly a decade since
I worked on that code.

I also don't recall why the 'dirty' flag is cleared in part1.

> Phil

       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list