My only need is to be sure to keep the right id; I did'nt use this method for other operations. You sayd that it's not recommended but I don't understand why in this simple context.

Andreas Jung ha scritto:



--On 9. März 2007 15:30:23 +0100 Jary Busato <[EMAIL PROTECTED]> wrote:

Yes, I must do it when I need to know an autonumber PK after an insert.
when DB support transaction i write:

begin transaction

insert foo into bar
<dtml-var sql_delimiter>
SELECT LAST_INSERT_ID() as lastid
commit

Sorry, but you must be crazy to perform you own transaction handling within Zope. Dealing with transactions is the task of Zope and your database but it is *not recommended* to perform your own transaction hand here...at least not in this way. If you want o integration a third-party system the transaction handling of Zope: look at the DataManager API of Zope's
transaction module.

-aj


_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to