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...
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...
It should. Create a DTML method called, say 'select_last_id': select LAST_INSERT_ID() AS id; then from dtml: <dtml-in select_last_id> This is the last inserted id: <dtml-var id> </dtml-in> --jfarr "Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998
LAST_INSERT_ID is the MySQL way to find out the last inserted id, how exactly didn't it solve your problem? phil ----- Original Message ----- From: "Andy" <andyman@n-factor.de> To: <zope@zope.org> Sent: 18 May 2000 00:44 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 )
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 )
participants (4)
-
Andy -
Jonothan Farr -
Phil Harris -
Ron Bickers