AutoCommit is a Dabo setting that lets Dabo know that the database
is configured to automatically commit changes, so that Dabo doesn't
try to duplicate that.
Some backends require an explicit commit after a change to the
database; others don't. For example, if you are using MySQL, and
execute the following command:
crs.execute("update employee set fired=1 where pk=86")
that record is updated. Anyone else querying that record will see
fired=1. However, if you were using an SQLite database, that change
is buffered; if you were to exit the app at this point, nothing would
have changed in the database. You need to call:
crs._connection.commit()
before any of your changes actually get persisted.
If I were using SQLite for my app, I would need to be sure that
AutoCommit was set to False for the employee bizobj. Since this is
passed to all the cursors that the bizobj uses, the cursors will know
that after a change they will have to manually call their
connection's commit() method, which is what the flush() method is
designed to do.
If I were using MySQL for the app, though, I should set AutoCommit
to True, but in practice it really doesn't matter, since the flush()
method is implemented for each backend, and for MySQL it does nothing
anyway.
So what you have to ask yourself is "If I insert/update/delete a
record, is that automatically committed to the database, or do I need
to call an explicit commit() to make the change permanent?". If the
former is the case, your bizobjs should have AutoCommit=True, since
committing changes is automatically done for you; if the latter, then
AutoCommit should be False.
Originally this was written so that all of this was encapsulated in
the backend, but there was a case (I don't remember the details)
where this was a setting that you could change in the database,
rather than a fundamental quality of the database. At this point we
refactored the behavior out into a developer-settable property.
OK, so now that you know what AutoCommit signifies and how it is
supposed to work, there are two discussions that we can have:
1) I think we should rename AutoCommit to ...[blank]
2) I've found somewhere in the code where what you've described isn't
working that way.
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]