Wed, 15 Jan 2003 00:16:06 +0100
Arenz, Ralph schrieb:
>i have a problem with mysql-transaction out of zope.
>I tried the transaction-mechanism in a external python
>program via the python DB-API , that work's fine.
>==> I used "commit" , "rollback" on the connection-object
>If i try to reproduce a transaction-handling in Zope, it fails.
>==>I tried the following in a external method and in a dtml-method:
> -> call a ZSQL-Method
>Can anyone enhance my horizon ?
First, in Zope the Z SQL Method and the DA shield you from calling
DB-API methods directly. The above won't work, 'cause you can't
(shouldn't!) access the DA/DB-API methods. (Sure, you could import and
use the DB-API, but don't do that except you're a Zope hacker and you
know *exactly* what you're doing; it will surely make your zopeing more
"interesting", read complicated).
Second, if you enable transaction support in your ZMySQLDA, Zope
includes the DBMS transactions into it's own TA handling where every TA
starts with a REQUEST (calling an object and interpreting it and the
invoked scripts/methods/etc.) and ends with the successful RESPONSE,
giving back the rendered output. If there's an exception somewhere
between (something that would usually result in a
standard_error_message) Zope rolls it's own *and* the DBMS transactions
Ergo, you usually don't need to mess with TAs, Zope does it for you. Let
it, and you'll be happy (except for some quite weird kinds of
application...). I've made good experiences myself with this mechanism :-)
For more knowledge about using Z SQL, please read the appropriate
chapter in the ZopeBook...