LAST INSERT ID driving me crazy
Hi guys, HOW HOW HOW HOW!!! Do I get at the last_insert_id() function, this is driving me absolutely crazy!! Zope docs say use "select last_insert_id()" but it doesn't work, gives me an error about bad SQL syntax around "LIMIT 1000". I tried googling it, I tried searching through other docs. And it just won't do it! I would like to make a separate ZSQL Method that will return to me the last insert id. Any help would be appreciated. Thank you. --------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
Alric Aneron wrote:
Hi guys, HOW HOW HOW HOW!!! Do I get at the last_insert_id() function, this is driving me absolutely crazy!! Zope docs say use "select last_insert_id()" but it doesn't work, gives me an error about bad SQL syntax around "LIMIT 1000". I tried googling it, I tried searching through other docs. And it just won't do it!
I would like to make a separate ZSQL Method that will return to me the last insert id.
Any help would be appreciated.
Thank you.
------------------------------------------------------------------------ Yahoo! Messenger with Voice. Make PC-to-Phone Calls <http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com> to the US (and 30+ countries) for 2¢/min or less. ------------------------------------------------------------------------
_______________________________________________ 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 )
try to switch off LIMIT 1000 (in the properties of ZSQLAdapter) robert
This is how it works for MySQL: insert into table_name ( ItemID, ItemDate, etc ) values ( <dtml-sqlvar ItemID type=int>, <dtml-sqlvar ItemDate type=string>, etc ) <dtml-var sql_delimiter> select LAST_INSERT_ID() as BaptismID You have to have the select LAST_INSERT_ID call in the same query as the insert, and you have to have the sql_delimiter. I have a vague recollection that LAST_INSERT_ID is MySQL specific. Cliff Alric Aneron wrote:
Hi guys, HOW HOW HOW HOW!!! Do I get at the last_insert_id() function, this is driving me absolutely crazy!! Zope docs say use "select last_insert_id()" but it doesn't work, gives me an error about bad SQL syntax around "LIMIT 1000". I tried googling it, I tried searching through other docs. And it just won't do it!
I would like to make a separate ZSQL Method that will return to me the last insert id.
Any help would be appreciated.
Thank you.
--------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
------------------------------------------------------------------------
_______________________________________________ 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 )
I don't think Zope provide the said feature. 1. I use ZopeTime (e.g. datetime_id.) as the last_insert_query id. You can use python date time too. 2. All related database tables have a datetime_id column 3. Using zsql method: insert into table_name set t_datetime_id=<dtml-sqlvar datetime_id type="string">, ........ Good Luck CY Alric Aneron <aluminum3458@yahoo.com> wrote: Hi guys, HOW HOW HOW HOW!!! Do I get at the last_insert_id() function, this is driving me absolutely crazy!! Zope docs say use "select last_insert_id()" but it doesn't work, gives me an error about bad SQL syntax around "LIMIT 1000". I tried googling it, I tried searching through other docs. And it just won't do it! I would like to make a separate ZSQL Method that will return to me the last insert id. Any help would be appreciated. Thank you. --------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2�/min or less._______________________________________________ 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 ) --------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
participants (4)
-
Alric Aneron -
Cliff Ford -
Infor Gates -
robert rottermann