[python-win32] adodbapi: using prepared statements

Tim Roberts timr at probo.com
Fri May 25 20:04:09 CEST 2012


Alan Trick wrote:
> On Fri, May 25, 2012 at 10:18 AM, Tim Roberts <timr at probo.com> wrote:
>> Is there any change if you use a tuple instead of a list?  That is:
>>
>>    cur.execute("select * from chiro1 where prefix = ?", ('LEG',))
> I get an identital exception with a tuple. For what it's worth, the
> value of cur.query is different, but I don't know if that has any
> effect on anything. With a list, cur.query is set to "select * from
> chiro1 where prefix = ?,parameters=['LEG']", with a tuple it's "select
> * from chiro1 where prefix = ?,parameters=('LEG',)".

I'd expect that.

I am at a loss. The adodbapi code gives the OLE DB provider a first shot
at processing the parameters.  If that fails, then the Python code does
the processing itself.  My guess is that the OLE DB provider here is
saying "it worked!", but isn't actually setting up the substitutions.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list