[Qt-interest] QSqlQuery and placeholders of the same name
Thiago Macieira
thiago.macieira at trolltech.com
Tue Dec 30 13:33:04 CET 2008
Bill KING wrote:
>It was correctly rejected, as in the sqlite case, placeholders are
>handled by the database engine itself and not qt, in this case, sqlite
>has failed to bind correctly, even tho we've told it to. In the case of
>database engines that don't support parameterised queries, then, we do
>substituion ourselves to fill out the query. Honestly, if you're trying
>to "be smart" by re-using the binding, don't, there's too many layers
>that it can go wrong in, and saving one line of code is really not worth
>it in the long run when you factor in testing, debugging, and rewriting
>the code in the end anyway to do both bindings.
Hint, rewrite your query like:
select * from some_table where columnA = :param AND
columnB = columnA
Then there's only one parameter to be replaced and the meaning is still
the same.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Software Engineer - Nokia, Qt Software
Qt Software is hiring - ask me
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081230/d7419d30/attachment.bin
More information about the Qt-interest-old
mailing list