QFX import problems

Benoit Grégoire bock at step.polymtl.ca
Thu Aug 5 22:56:55 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 05 August 2004 06:57 pm, Derek Atkins wrote:
> Benoit Grégoire <bock at step.polymtl.ca> writes:
> >> > Well, since I was told at the time not to use the engine's revert
> >> > function, there isn't much choice is there...
> >>
> >> What "engine's revert function"?
> >
> > xaccTransRollbackEdit()
>
> This only works if you run it before you xaccTransCommitEdit().  It
> doesn't remove a transaction, nor does it undo a commit..  It just
> reverts back to the state when you ran xaccTransBeginEdit(), which has
> no effect in the case of an import because the transactions really
> shouldn't "exist" until the import completes.

Well, there is already code in the importer that, at the very end, either 
commits every transactions still flagged to be imported, and deletes (and 
commits) every other.  Trouble is the engine doesn't handle (well, so I was 
told) reverts cleanly enough to change it to commit transactions to be 
imported, revert others.
>
> > Still, you have to admit that if I could just xaccTransRollbackEdit() to
> > cancel and xaccTransCommitEdit() all at once, we'd have a much cleaner
> > solution.  What good is having an engine if we have to reimplement parts
> > of it each time we want to mess with it's data?
>
> Agreed, somewhat... At some level "mass import" is really an import
> function, not an engine function.  I can't think of anywhere outside
> the import modules that need to handle this.  I was hoping that the
> generic importer would handle this by not creating the Transaction*
> until "late" in the process and using the "generic_transaction" object
> instead through the import process...
>
> HOWEVER, we actually need an "undo" operation anyways in QOF.. In
> particular once we move to a SQL-backed engine we really want to
> "undo" changes..  I don't know exactly how that should work, or at
> what granularity.  I can see how it's relatively easy to perform a QOF
> "undo" on individual objects, but I'm not sure how to do it en-masse,
> ala "undo import".

Well, you don't need an "undo import".  You necessarly still have pointers to 
every transactions untill the very end of the import process.  As long as you 
didn't commit, you can revert objects individually by walking the list.  
That's already what the code does to do the commits.

Maybe one day I'll have time to look into this.  At worst, there's only few 
decades left till retirement ;)

- -- 
Benoit Grégoire, http://benoitg.coeus.ca/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBEvN3mZ6zzPlLuwMRAsmGAJ4pf/HTJVaZTu6fUFZegQaStZVyrACgkMTx
FI5mZSYx7HwOAEmkzN8AOGE=
=xppv
-----END PGP SIGNATURE-----



More information about the gnucash-devel mailing list