[Zope] Zope/MySQL : LAST_INSERT_ID()
chas
panda@skinnyhippo.com
Fri, 29 Oct 1999 01:15:48 +0800
The following SQL statement works fine from
the MySQL prompt :
select LAST_INSERT_ID()
and it returns the last ID used in an auto_increment field
within the current session/connection.
However, a ZSQL method which takes no arguments and only
has that one line of code fails with the error :
Traceback (innermost last):
File D:\Inetpub\AsiaHype\lib\python\ZPublisher\Publish.py, line 214, in
publish_module
File D:\Inetpub\AsiaHype\lib\python\ZPublisher\Publish.py, line 179, in
publish
File D:\Inetpub\AsiaHype\lib\python\Zope\__init__.py, line 201, in
zpublisher_exception_hook
(Object: ZSQL_SelectLastInsertID)
File D:\Inetpub\AsiaHype\lib\python\ZPublisher\Publish.py, line 165, in
publish
File D:\Inetpub\AsiaHype\lib\python\ZPublisher\mapply.py, line 160, in
mapply
(Object: manage_test)
File D:\Inetpub\AsiaHype\lib\python\ZPublisher\Publish.py, line 102, in
call_object
(Object: manage_test)
File D:\Inetpub\AsiaHype\lib\python\Shared\DC\ZRDB\DA.py, line 316, in
manage_test
(Object: ZSQL_SelectLastInsertID)
File D:\Inetpub\AsiaHype\lib\python\Shared\DC\ZRDB\DA.py, line 297, in
manage_test
(Object: ZSQL_SelectLastInsertID)
File D:\Inetpub\AsiaHype\lib\python\Shared\DC\ZRDB\DA.py, line 401, in
__call__
(Object: ZSQL_SelectLastInsertID)
File D:\Inetpub\AsiaHype\lib\python\Products\ZMySQLDA\db.py, line 191, in
query
KeyError: (see above)
Has anyone else encountered or resolved this error ?
In the meantime, I'm simply going to use an external method or python
method since I know that the following Python code works :
>>> DBH = MySQL.connect()
>>> DBH.insert_id()
cheers,
chas