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

Jorge Godoy godoy at ieee.org
Sun Feb 27 17:51:07 GMT 2005

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

> Just mangle one of the SQL examples, that comes with Qt...

I think it won't be necessary.  Your code works here, so it is not a Qt

> You can't use the Python DB API syntax, since it's completely bypassed 
> with Qt SQL. I was talking about the usual Python string syntax, but 

That's what I thought: I can't use it because I'm using a Qt abstraction.

> you're right, you have to handle the quoting yourself in this case.

Yep.  I'm not going into this.  I'd use an alternative without the SQL layer
of Qt if I had to do that.  It would leave me worried on each and every error
or database problem.

It won't be worth it.

> BTW, I just checked your problem with the attached script, MySQL, and 
> a database as defined as in testdb_mysql.sql from PyQt/examples3/SQL 
> without such problems.

Weird.  It worked here too.

I'll check my query again...  But one difference is that I used triple quotes
for multiline commands and you didn't. 

Changing that on your code also made no difference and worked.

There must be, then, something on my code that is preventing that from
working.  I'll check it and I'll post here if I find out what it is.

> Python version: 2.3+

Python 2.3.4

> sip version: 4.2

sip 4.1.1.

> Qt version: 3.2.1

Qt 3.3.4

> PyQt version: 3.14

PyQt 3.13.

> MySQL version: 4.0.21

I'm using PostgreSQL here, both 7.4.6 and 8.0.1. 

> Cheers,
> Pete

Thanks for the help, Pete.

Be seeing you,

More information about the PyQt mailing list