On Thu, 23 May 2013 16:59:27 +0200, M.-A. Lemburg <m...@egenix.com> wrote:
On 22.05.2013 00:52, Michael Bayer wrote:
As a total aside, I also have issues with some DBAPIs that accept *only* a list for the "sequence", 
others that accept *only* a tuple (this may be only when the parameter list is empty, however).   So 
specifying the significance of "empty" parameter lists as well as how to test for 
"sequence" would be nice too, so that I can hit the DBAPI authors with bug reports backed up by the 
spec.
The DB-API is already clear on this: any sequence should be
accepted for .execute() and any sequence of sequences for .executemany().

Spelling out the special case of passing an empty sequence to
.execute() and .executemany() would probably be wise. For .execute()
this would only be valid for a statement that doesn't have parameter
markers. For .executemany() this would be the same as a no-op (and
only serve a purpose on the basis that it makes writing algorithms
easier).


I'd like to suggest that if the bind parameter is nonzero (i.e. __nonzero__ method call) then it is assumed there are no params. This way we don't have to get into is it an empty sequence, is it None, etc.

Chris


_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to