[Zope-DB] Compound SQL Statements

Roy S. Rapoport zope-db at ols.inorganic.org
Tue Jun 29 19:23:20 EDT 2004


I'm using Zope 2.7.0 with ZMySQLDA 2.0.9 and Python-MySQL 1.1.1.

Trying to use this bit of SQL:
---
INSERT INTO person
(Login, Password, FirstName, LastName, Email, Organization, Title, Street1,
Street2, City, State, Postal, Country)
VALUES(
	'roy2',
	'as',
	'asdf',
	'asd',
	'sd',
	'da',
	'a',
	'd',
	'd',
	'j',
	'j',
	'j',
	'j'
);

SELECT LAST_INSERT_ID()
---
 
Within a ZSQL statement nets me:
Error, _mysql_exceptions.ProgrammingError: (1064, "You have an error in
your SQL syntax. Check the manual that corresponds to your MySQL server
version for the right syntax to use near ';\n\nSELECT LAST_INSERT_ID()' at
line 18") 

Even though this seems like perfectly legit SQL code (and it works within a
mysql interpreter).

Thoughts? Is there another recommended way I can get the ID of the last
inserted row?

-roy


More information about the Zope-DB mailing list