[Zope] ZSQL-Methods: last inserted id
Ron Bickers
rbickers@logicetc.com
Thu, 18 May 2000 12:29:50 -0400
You can get a ZSQLMethod that's used for inserting to return the last
inserted ID by doing the following:
INSERT ...whatever...
<dtml-var sql_delimiter>
SELECT LAST_INSERT_ID() AS newid
You get the results as you would with any ZSQLMethod:
<dtml-in my_zsql_method>
Inserted ID: <dtml-var newid>
</dtml-in>
_______________________
Ron Bickers
Logic Etc, Inc.
rbickers@logicetc.com
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Andy
> Sent: Wednesday, May 17, 2000 7:45 PM
> To: zope@zope.org
> Subject: [Zope] ZSQL-Methods: last inserted id
>
>
>
> I wonder how I can find out about the last inserted id of a row in my
> mysql-database, which I inserted through a ZSQL-Method...
>
> I tried mysql's built-in function LAST_INSERT_ID(), but that did not solve
> my problem...
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
>