SQL backend and dirty books
Derek Atkins
warlord at MIT.EDU
Fri Jul 11 21:43:42 EDT 2008
Phil,
Quoting Phil Longstaff <plongstaff at rogers.com>:
> I've investigated my transaction/split issue further and it appears
> as though the problem is in how qof determines that the books are
> dirty.
>
> There is an alt_dirty_mode flag in qof and the gc engine sets it to
> TRUE. When this flag is set, *after* the backend is called during
> the second part of a qof_commit_edit() call, the collection and book
> are marked dirty. While this may be fine for an XML backend where
> the commit does not really save anything and therefore the books
> really *are* dirty, it is not OK for an SQL backend. If the concept
> of the books being dirty means that there is unsaved content, then
> the backend should have more control over that status.
>
> Derek's vision seems to be that sqlite replaces xml as the standard
> backend, and that xml might still exist as an import/export
> mechanism. If that is what is adopted (seems fine to me, but some
> concensus would be good), then I'll need to look at and possible
> clean up the whole dirty mechanism.
It would be nice if there were more consensus on that. :)
> For now, I think I've fixed my problem by pushing the problem code
> down into the xml backend and out of qof. This means that a commit
> using the file backend *does* mark the books as dirty, whereas a
> commit using the sql backend does not.
I think it depends on how you did it. I haven't looked at your changeset
yet, but how I think it should work is:
1) In the first part of the commit, qof (or above) sets the object dirty.
2) The backend is called. The backend can clear the dirty flag if necessary.
One issue is that there are still ways to dirty the book outside of
a begin/commit. In particular modifications to a KVP Frame don't
take a begin/commit and don't dirty the book.
I don't see why the book would be dirtied AFTER the commit. You are
correct that THAT is just broken.
> Phil
-derek
PS: I'm sorry I haven't responded to BOTH of your queries on this topic.
I've been so busy with real work and some house construction that I've
dropped lots of things on the floor, this being one of them. All I can
say is I'm Sorry, and I'll try to be a little more responsive going forward.
On the other hand, I start one month of travel in about 13 hours so I
dont know how responsive I'll be while on the road, either. I'll do what
I can, and maybe respond from 35,000 feet. ;)
--
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