curious paramstyle qmark behavior

BartlebyScrivener rpdooling at gmail.com
Fri Oct 20 22:06:58 CEST 2006


With

aColumn = "Topics.Topic1"'

The first statement "works" in the sense that it finds a number of
matching rows.

c.execute ("SELECT Author, Quote, ID, Topics.Topic1, Topic2 FROM
QUOTES7 WHERE " + aColumn + " LIKE ?", ("%" + sys.argv[1] + "%",))

I've tried about 20 different variations on this next one. And it finds
0 records no matter what I do. Is there some violation when I use two
qmarks?

c.execute ("SELECT Author, Quote, ID, Topics.Topic1, Topic2 FROM
QUOTES7 WHERE ? LIKE ?", (aColumn, "%" + sys.argv[1] + "%"))

I'm using mx.ODBC and Python 2.4.3 to connect to an MS Access DB.

Thank you,

rd




More information about the Python-list mailing list