How do I speedup this loop?

Istvan Albert ialbert at mailblocks.com
Tue Jul 13 15:54:01 CEST 2004


David Fraser wrote:

> Except if you're aiming for database independence, as different database 
> drivers support different means of escaping parameters...

IMHO database independence is both overrated not to mention impossible.
You can always try the 'greatest common factor' approach but that
causes more trouble (and work) than it saves.

I agree with the previous poster stating that escaping should be done
in the DB API, but it is better to use the 'typed' escaping:

sql = 'SELECT FROM users WHERE user_id=%d AND user_passwd=%s'
par = [1, 'something']
cursor.execute(sql, par)

Istvan.





More information about the Python-list mailing list