[Zope] ZSQL Methods and SELECT functions
Robert Ln
soundhack@yahoo.com
Sat, 16 Mar 2002 09:14:44 -0800
Hi all,
I am using Zope 2.5.0 and the latest ZMySQLDA. I have a few
related questions.
1) If I insert a new row into the mysql database that has
an auto_insert column (say 'id'), how do I get the automatically
generated id? In mysql you would use the LAST_INSERT_ID()
function, but this doesnt work in a zsql method
2) The reason 1) doesnt work is that zsql methods (and
the underlying python-mysql db interface) doesnt seem
to allow select functions. Something like
SELECT 1+1 doesnt work. Is there any way of getting this to work?
3) Actually, I see from the python mysql db interface that the cursor
object has an insert_id() method. Does the ZMySQL DA allow any
way of getting at this method?
4) Finally, the mysql docs say the last_insert_id() returns the last
automatically generated id on a per-connection basis. If in zope
only a single connection is made and a lot of clients are accessing
it at once, how do I guarantee I get back the correct id? I thought
you could concatenate multiple SQL queries in one zsql method, but
that doesnt seem to work anymore.
Thanks!
Robert
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com