DBI spec and parameter passing
Gordon McMillan
gmcm at hypernet.com
Mon Jan 17 19:24:21 EST 2000
Skip wrote:
> Instead of doing the parameter interpolation yourself, try letting your
> database module do it for you, e.g.:
>
> c = db.cursor()
> c.execute("""select id from city where"""
> """ city = %s and"""
> """ state = %s and"""
> """ country = %s""", (city, state, country))
but Skip _meant_:
c.execute(""" select id from city where city = ? and state = ?
and country = ?""", (city, state, country))
- Gordon
More information about the Python-list
mailing list