GDA: Question about some engine transaction functions

Phil Longstaff plongstaff at
Sun Mar 30 21:19:21 EDT 2008

src/engine/Transaction.c has the following functions:

static void
qofTransSetNum (Transaction *trans, const char *xnum)
        if (!qof_begin_edit(&trans->inst)) return;
        xaccTransSetNum(trans, xnum);
xaccTransSetNum (Transaction *trans, const char *xnum)
   if (!trans || !xnum) return;
   CACHE_REPLACE(trans->num, xnum);
   mark_trans(trans);  /* Dirty balance of every account in trans */

qofTransSetNum() is the function which is registered with qof, and if
there is a function registered with qof, the gda backend tries to use
it.  The problem is that if the editlevel is not 0 (which it is, because
the gda backend calls xaccTransBeginEdit() before the tx is loaded from
the db and xaccTransCommitEdit() after it is loaded), qof_begin_edit()
will return FALSE so that the routine does nothing, but does leave the
editlevel incremented.

Is this correct behaviour?  If so, it is not useful to me.  Note that
there are a number of these pairs of routine in Transaction.c and there
may be more in other files.


More information about the gnucash-devel mailing list