[Zope] ZSQL and last_insert_id

Andy andy@agmweb.ca
Tue, 19 Feb 2002 17:09:11 -0800


Depends entirely upon your database and not ZSQL Methods. Read your db
documentation.

----- Original Message -----
From: "Chad Nantais" <cnantais@rednaxel.com>
To: <zope@zope.org>
Sent: Tuesday, February 19, 2002 3:03 PM
Subject: [Zope] ZSQL and last_insert_id


> What is the right syntax for getting the id of the last recorded inserted
> with ZSQL methods? I tried this:
> SELECT LAST_INSERT_ID() AS last_insert_id
>
> The resulting error is:
> Traceback (innermost last):
>   File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/Publish.py, line 223,
> in publish_module
>   File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/Publish.py, line 187,
> in publish
>   File /usr/local/zope/2.4.4b1/lib/python/Zope/__init__.py, line 226, in
> zpublisher_exception_hook
>     (Object: last_insert_id)
>   File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/Publish.py, line 171,
> in publish
>   File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/mapply.py, line 160,
in
> mapply
>     (Object: manage_test)
>   File /usr/local/zope/2.4.4b1/lib/python/ZPublisher/Publish.py, line 112,
> in call_object
>     (Object: manage_test)
>   File /usr/local/zope/2.4.4b1/lib/python/Shared/DC/ZRDB/DA.py, line 400,
in
> manage_test
>     (Object: last_insert_id)
>   File /usr/local/zope/2.4.4b1/lib/python/Shared/DC/ZRDB/DA.py, line 378,
in
> manage_test
>     (Object: last_insert_id)
>   File /usr/local/zope/2.4.4b1/lib/python/Shared/DC/ZRDB/DA.py, line 493,
in
> __call__
>     (Object: last_insert_id)
>   File /usr/local/zope/instance/Products/ZMySQLDA/db.py, line 252, in
query
> OperationalError: (1064, "You have an error in your SQL syntax near
> 'last_insert_id LIMIT 1000' at line 1"
>
>
>
>
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>