[Zope] MySQL LAST_INSERT_ID...

Rob Page rob.page@digicool.com
Tue, 16 Mar 1999 10:20:45 -0500


>  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()

Try:

select LAST_INSERT_ID() as fred

then grab <!--#var fred-->

If this works then I know what the problem is!  :^)

If you use the database's command line tool and run this SQL statement I
bet it returns a single value (i.e., it doesn't return a table).  The DA
wants to munge and chew on rows in tables.  If think that if you use the
select LAST_INSERT_ID() as fred you'll get a one-row, one-column table
-- this is what Zope wants.

--Rob