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

Then, a DTML method:

<dtml-in myZSQLinsertandselect()>
 <dtml-var lastid>
</dtml-in>

Make the insert and write the id returned by the select.

Illorca

Gaute Amundsen ha scritto:
On Friday 09 March 2007 10:12, Remil Mathew wrote:
  
Hi,
How can run  multiple query in an Z sql method.. I am using Mysql..
Also is there any method to return a value from insert query?

Thanks
Remil
    

could you possibly be thinking of?

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


gaute
_______________________________________________
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 )
.

  

_______________________________________________
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