[Zope] MySQL LAST_INSERT_ID...

raver@box.dust.za.net raver@box.dust.za.net
Tue, 16 Mar 1999 20:49:17 +0100


On Mon, Mar 15, 1999 at 11:17:44PM -0500, 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?

Why not use:

select 'id_field_name' from 'table' where 'id_field_name' IS NULL

id_field_name beeing the field with AUTO_INCREMENT set

Hope this helps - Sture 
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Tom Jenkins                    DevIS (http://www.devis.com)
> Linux & Samba 2.0 : The best Windows file server
> http://www.zdnet.com/sr/stories/issue/0,4537,2196106,00.html                                         
> "Do not be overcome by evil, but overcome evil with good." Romans 12:21
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>