[Zope] MySQL LAST_INSERT_ID...
Jordan B. Baker
jbb@spyderlab.com
Tue, 16 Mar 1999 12:01:32 -0500 (EST)
On Mon, 15 Mar 1999, Tom Jenkins wrote:
> To followup my last post, I'm getting an exception when trying to use
> MySQL's "select LAST_INSERT_ID()" function:
>
> Error, exceptions.KeyError: unhandled
>
> SQL used:
>
> select LAST_INSERT_ID()
>
> Anybody have any ideas?
Try: select LAST_INSERT_ID()+0 to cast it to an int...
Also, check your declaration for LAST_INSERT_ID().. if the above doesn't
work you'll need to either try the patch for ZMySQLDA that was posted a
week or so ago, or do something like: SELECT CONCAT(LAST_INSERT_ID()) to
cast it to a string and then use a nifty Python fn. to convert it to an
integer number.
It seems the MySQL driver has problems with some datatypes. There was a
patch posted befure.. I'm curious to know if it'll fix this problem...
-------
Jordan B. Baker -- jbb@spyderlab.com
weaving the web @ http://www.spyderlab.com