[Zope] Problem with Z SQL Method

Jeffrey Shell Jeffrey@digicool.com
Tue, 15 Jun 1999 19:03:19 -0400


Doug Wyatt:
> I ran into this when trying to have a method return LAST_INSERT_ID().
> 
> I forget the exact nature of the problem, but it had something to do 
> with the return variable type or its column name.  This worked:
> 
> 	select CONCAT(LAST_INSERT_ID()) as insID
> 
> (CONCAT converts to a string, as insID gives the returned 
> column a name)

Right.  This is (yet another) piece of nature that varies from database
to database.  Basically, whenever you use SQL functions as the columns
you want returned, use the AS keyword.  Some databases will create a
column name (ie, 'a1'), others return something unusable, others won't
work at all if you don't use the AS ___.

The data type shouldn't be a problem.

.jPS