[PyKDE] Re: Using QSqlQuery + bindValue = TypeError ?

Jorge Godoy godoy at ieee.org
Sun Feb 27 15:10:24 GMT 2005


Hans-Peter Jansen <hpj at urpla.net> writes:

> You may try to reproduce this behaviour within a minimal Qt example, 
> since I would suspect this problem there.. PyQts cover is just to 
> thin to mangle the results in such a way ;-)

I'll try and see if I remember enough C++ for that (hey! it's been more than 5
years that I don't write C or C++ code, thanks to Perl and Python ;-))

> Anyway, I would go the pythonic way by using %s or in more complex 
> situations dictionary referencing: %(senha)s with python strings..

The problem here is loosing the "auto-quoting" facility.  I'd have to check
the string to see if there's no single quote inside it or anything else that
can be used to trick the DB and do something that is not allowed. 

Letting the driver quote everything I don't have to worry with that.  At
least, everything used to be correct with both pypgsql and psycopg when I used
to use wxPython for this application.


OR, did I misunderstand you and PyQt will auto-quote things correctly if I use
the DB API syntax?


Thanks again,
Godoy.




More information about the PyQt mailing list