[DB-SIG] Multiple Statements

M.-A. Lemburg mal@lemburg.com
Wed, 29 May 2002 09:22:44 +0200


Andy Dustman wrote:
> On Tue, 2002-05-28 at 15:36, Gerhard H=E4ring wrote:
>=20
>>From my interpretation of the DB-API specfication, it's not possible to
>>put multiple SELECT statements into one execute() call. That's what
>>.executemany() with .nextset() is for, right? Do I really have to
>>support this in a DB-API compliant module, though?
>=20
>=20
> Nearly all DB-API modules I have seen require a single statement passed
> to either execute() or executemany(), i.e. no multiple statement
> queries. nextset() is for SELECTs which return multiple result sets;
> I've never seen this used.

The usual place where you'd find .nextset() used is when
calling stored pocedures which result in multiple result
sets.

Having multiple statements in a single .execute() is normally
not allowed by the databases (unless maybe you are defining
a stored procedure in which case the multiple statements
are wrapped up in a single procedure defining statement).

>>What about multiple non-SELECT SQL statements seperated by ; in an
>>execute() call (read: INSERT, UPDATE, PRAGMA).  Would this be valid?
>>Again I personally would use executemany(). I'm just wondering if I hav=
e
>>to have to account for it in an execute() call.
>=20
>=20
> Also, the only thing I have ever seen executemany() used for is a
> multi-row INSERT.

--=20
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/
Meet us at EuroPython 2002:                 http://www.europython.org/