[Zope] ZSQL method LAST_INSERT_ID() error
paul_s_johnson@urscorp.com
paul_s_johnson@urscorp.com
Tue, 13 Mar 2001 17:57:22 -0600
Thanks for the all tips; it's getting me down the right road.
I also learned I need to include my LAST_INSERT_ID in the same ZSQL method
as my INSERT statement and join them together with a <dtml-var
sql_delimiter> inside the method.
That said, it's still not working. Here's what's returned when I test my
method:
There was no data matching this sql_add_deliverable query. SQL used:
INSERT INTO Deliverables (
DeliverableID,
ProjectID,
DeliverableTypeID,
UserID,
Abstract,
DateEntered,
CategoryRequest)
VALUES (
NULL,
1,
2,
3,
'some text blah blah',
NOW(),
'5')
------------------------------------------------------------
SELECT LAST_INSERT_ID() AS TheLastID
The INSERT part of the above works and inserts the data into the table. The
DeliverableID field of the Deliverables table is really an AUTO_INCREMENT
field. I tested the above at the MySQL command line and the LAST_INSERT_ID
() function returns the correct ID. Why is no data returned? I should be
getting the last ID and I'm getting nothing. Help!
P. Johnson
http://www.zope.org/Members/adustman/Tips/no_limits
On Tue, 13 Mar 2001 paul_s_johnson@urscorp.com wrote:
> This ZSQL query:
>
> SELECT LAST_INSERT_ID() AS ID
>
> Is returning this error:
>
> Error, _mysql.OperationalError: (1064, "You have an error in your
SQL
> syntax near 'LIMIT 1000' at line 1")
>
> It apparently automatically adds a LIMIT clause to the end of my SQL
query
> that MySQL does not like in this context. Is there any way to shut the
> limit clause off? Anybody have any ideas for a workaround?
--
Andy Dustman PGP: 0xC72F3F1D
@ .net http://dustman.net/andy
"Normally with carbonara you use eggs, but I used lobster brains instead."
-- Masahiko Kobe (Iron Chef Italian): 30-year-old Giant Lobster Battle