DBI cursor behaviour with multiple statements?

Mark Charsley mark.charsley at REMOVE_THIS.radioscape.com
Tue Oct 1 06:32:00 EDT 2002


In article <23891c90.0209300554.5b37c195 at posting.google.com>, 
paul at boddie.net (Paul Boddie) wrote:

> An interesting, related issue is the treatment of the IN operator, and
> this doesn't necessarily yield uniform treatment across database
> modules, even for the same database system (compare pyPgSQL and
> psycopg on PostgreSQL). For some applications of your query (where you
> want the union), the IN operator is probably what is desired:
> 
>   "SELECT * FROM table WHERE column IN %s"
> 
> This appears highly counter-intuitive, of course, since the
> Python-style %s parameter marker actually represents a list in this
> case - another reason for choosing a better parameter notation.

Does that work? I've never been able to pass in a list of things like that 
in either ODBC or ADO from C++. Which means:
a) the python library isn't cacheing the execution plan, and is just 
building a new building a new SQL statement with each call (which is going 
to have serious consequences), or 
b) it's possible to make DB calls from python that can't be made from C++, 
or
c) I've been an idiot


-- 

Mark - personal opinion only, could well be wrong, not representing 
company, don't sue us etc. etc.



More information about the Python-list mailing list