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

Hans-Peter Jansen hpj at urpla.net
Sun Feb 27 15:02:27 GMT 2005


Hi Godoy,

On Sunday 27 February 2005 15:37, Jorge Godoy wrote:
> Hans-Peter Jansen <hpj at urpla.net> writes:
> > Try:
> >     query.bindValue(":senha", QVariant(senhaNova))
>
> I found out that this also don't work.  The binding variable isn't
> removed from the query when it is sent to the database and it also
> fails.  If I use "?" as a positional placeholder, the query is
> completed sucessfully.
>
> Is it a bug too?
>
> There's no mention that this is an exclusive option on the docs,
> they say that I can use either the position or the name to bind
> values.

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

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

Pete




More information about the PyQt mailing list