[Qt-interest] QSqlQuery bindValue sqlite3

Scott Aron Bloom Scott.Bloom at onshorecs.com
Tue Jan 11 23:50:57 CET 2011


I believe the QSqlQuery as a "feature" will only bind the first named
parameter matching.

 

To the point where you may have to do a 

 

"select 1, 2, 4 from MY_TABLE WHERE (:a1 = '' OR my_field like :a2)"

bindValue(":a1", "the value");

bindValue(":a2", "the value");

 

 

 

 

 

From: qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com
[mailto:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com] On
Behalf Of Sylvain Pointeau
Sent: Tuesday, January 11, 2011 2:15 PM
To: qt-interest at qt.nokia.com
Subject: [Qt-interest] QSqlQuery bindValue sqlite3

 

Hi,

 

there is a bug when the query contains multiple placeholders like:

 

"select 1, 2, 4 from MY_TABLE WHERE (:a = '' OR my_field like :a)"

bindValue(":a", "the value");

 

only the first one seems to be replaced.

 

If I use the sqlite api, this example is working fine.

 

is it a bug or a "feature"?

 

Best regards,

Sylvain

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110111/607442b7/attachment.html 


More information about the Qt-interest-old mailing list