[PyQt] Re: QSqlQuery.addBindValue malfunction

Fabiano Sidler fabianosidler at gmail.com
Thu May 24 17:49:27 BST 2007


2007/5/24, Henrik Pauli <henrik.pauli at gmail.com>:
> Maybe % is special in python

No, as I've found out now, the problem is that Qt does not parse
placeholders in strings embedded in the query string itself. So I have
to force the users to type in the % characters into the QLineEdit from
which my application gets its bindValue. Interestingly, the SQL
statement works when I omit the '"' chars around the LIKE string! :o

> (I vaguely remember it being so)

What you probably mean is the "%" used in format strings:
>>> print '%s, %s and %s' % ('Alice','Bob','Chuck')
Alice, Bob and Chuck

However, this is no special syntax. It's merely the modulo operator of
string objects that performs formatting!

Thank you for your answer anyway!
Greetings,
Fabiano


More information about the PyQt mailing list