[Interest] QSQLQuery bindValue to SELECT WHERE IN

Scott Aron Bloom scott.bloom at onshorecs.com
Tue Apr 9 17:57:35 CEST 2013


It will depend the server backend.. However in general, I have never been successful (not just in Qt, at all) in binding for "lists"

I would do a "IN (:id1,:id2,:id3)" and have multiple binds

Scott


From: interest-bounces+scott.bloom=onshorecs.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at qt-project.org] On Behalf Of Witold E Wolski
Sent: Tuesday, April 9, 2013 8:35 AM
To: interest at qt-project.org
Subject: [Interest] QSQLQuery bindValue to SELECT WHERE IN

Trying to bind a value to :

SELECT * from features WHERE id IN (:ids)

I tried 2 versions:
First, build a list with the ids I want to select.
Creating a QList<QVariant> qlist;
Second version building a QString (i.e. "1,2,3")
Than I bind it to the query above
query.bindValue(":ids",qlist);


But unfortunately with neither I get result. No errors too.

executing a query
SELECT * from features WHERE id IN (1,2,3)
works fine.

Can anyone please tell me the right solution please?
Best



--
Witold Eryk Wolski

Triemlistrasse 155
8047 Zuerich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130409/33758f9e/attachment.html>


More information about the Interest mailing list