[DB-SIG] Cursor.executemany() and Cursor.nextset()

Bob Kline bkline@rksystems.com
Tue, 7 Aug 2001 08:08:39 -0400 (EDT)

On Tue, 7 Aug 2001, Dittmar, Daniel wrote:

> > What I am trying to say (and so are you, it appears) is that such
> > behavior doesn't make sense if the SQL behind that action contains
> > SELECT statements. 
> At least in SAP DB, array SELECTS are possible and amount to the
> UNION of all the single SELECTs.
> I would prefer the spec to say that the behaviour is undefined
> rather than requiring the driver to raise an exception.

Please go back and re-read the message to which you are responding.  I
did not ask that the spec require the driver to raise an exception.  I

    "Therefore it seems apparent to me that while executemany() may be
     safely useful for DML the API should clearly state that use of this
     method for operations which produce result sets constitutes
     undefined behavior, and may result in an exception being raised by
     the driver."

> Mostly because I don't want to look at the SQL command at all.

Precisely.  If you don't parse the first argument to the executemany()
method (and, for most data sources, even if you do), you will not be
able to distinguish consistently between cases which could be safely
mapped to the semantic equivalent of an array SELECT and those which
cannot, for all possible data sources.

The fact that there may be a DBMS with such restricted capabilities (for
example, no stored procedures or user-defined functions) for which it
might be possible to make such a distinction does not mean that the API
specification can safely ignore the general case.

Bob Kline