[Zope] insert_id with MySQL an Z SQL Method

Cliff Ford Cliff.Ford at ed.ac.uk
Fri Sep 1 15:03:52 EDT 2006


Search the mailing list archives for July - there were several 
contributions to this question. Roughly:

insert ...
<dtml-var sql_delimiter>
select LAST_INSERT_ID() as table_id_seq

Cliff

Ferhat Ayaz wrote:
> Hi,
> 
> I have a Z SQL Method with an insert expression. To
> the inserted row will be assigned an auto_increment
> id. How can I get the last inserted id?
> 
> I tryed the following both commands in one Z SQL
> method. Unfortunatly this produces an error.
> 
> insert into categories (parent_id,logo,active) values
> (
>  <dtml-sqlvar parent_id type="int">,
>  <dtml-sqlvar logo type="string">,
>  <dtml-sqlvar active type="int">,
> );
> 
> SELECT currval('table_id_seq');
> 
> Thanks for your helps
> 
> Greets,
> Ferhat
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> _______________________________________________
> Zope maillist  -  Zope at 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 )


More information about the Zope mailing list