[Zope-DB] MySQL ZSQL Transactions or Commit in Zope?
dieter at handshake.de
Tue May 17 13:51:27 EDT 2005
Michael Schwartz wrote at 2005-5-15 16:30 -0400:
>I am trying to find sample code for performing transactions in ZSQL with
>mysql 4.1. I'd like to do something like this:
>1 - Insert record A into USER table
>2 - Get auto_increment id for record A
>3 - Insert record B into WIDGET table with auto_increment id from
>But if step 3 fails, I want to undo step 1.
Provided you use transactional tables (i.e. you use MySQL
in a way that it support transactions), then you only
need to abort the Zope transaction (which happens automatically
when an exception reached ZPublisher).
More information about the Zope-DB