How do I speedup this loop?

David Fraser davidf at sjsoft.com
Tue Jul 13 14:44:35 EDT 2004


Istvan Albert wrote:
> 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.

Not overrated or impossible. It's part of our business model. It works.

> 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)
> 

Better if the database driver you are using supports it... otherwise 
userless
I think there is a need to drive towards some sort of standard approach 
to this in DB-API (maybe version 3?) as it otherwise nullifies 
parameters for anyone using multiple database drivers.

David



More information about the Python-list mailing list