[Zope-DB] ZSQL and last_insert_id
Chad Nantais
cnantais@rednaxel.com
Tue, 19 Feb 2002 18:04:30 -0500
What is the right syntax for getting the id of the last recorded inserted
with ZSQL methods? I tried this:
SELECT LAST_INSERT_ID() AS last_insert_id
The resulting error is:
Traceback (innermost last):
File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/Publish.py, line 223,
in publish_module
File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/Publish.py, line 187,
in publish
File /usr/local/zope/2.4.4b1/lib/python/Zope/__init__.py, line 226, in
zpublisher_exception_hook
(Object: last_insert_id)
File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/Publish.py, line 171,
in publish
File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/mapply.py, line 160, in
mapply
(Object: manage_test)
File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/Publish.py, line 112,
in call_object
(Object: manage_test)
File /usr/local/zope/2.4.4b1/lib/python/Shared/DC/ZRDB/DA.py, line 400, in
manage_test
(Object: last_insert_id)
File /usr/local/zope/2.4.4b1/lib/python/Shared/DC/ZRDB/DA.py, line 378, in
manage_test
(Object: last_insert_id)
File /usr/local/zope/2.4.4b1/lib/python/Shared/DC/ZRDB/DA.py, line 493, in
__call__
(Object: last_insert_id)
File /usr/local/zope/instance/Products/ZMySQLDA/db.py, line 252, in query
OperationalError: (1064, "You have an error in your SQL syntax near
'last_insert_id LIMIT 1000' at line 1"