Help: Omitting quotes from SQL Queries.

Gerhard Häring gerhard.haering at gmx.de
Tue Jan 7 19:47:34 EST 2003


* Gerhard Häring <gerhard.haering at gmx.de> [2003-01-08 01:13 +0100]:
> * Eric Brunel <eric.brunel at pragmadev.com> [2003-01-07 17:20 +0100]:
> > keithk wrote:
> > > Hi All,
> > > 
> > > I am using an mx.ODBC connection [...]

> Use DB-API bound parameters:
> 
>     cursor.execute("""
>         SELECT fileSize FROM database
>         WHERE database.filename = %s
>         """, (fileName,))
 
I believe the parameter placeholder for ODBC is '?' instead of '%'.  To
be sure check the mxODBC docs :)

Gerhard
-- 
Favourite database:             http://www.postgresql.org/
Favourite programming language: http://www.python.org/
Combine the two:                http://pypgsql.sf.net/
Embedded database for Python:   http://pysqlite.sf.net/





More information about the Python-list mailing list