[Interest] Did the bound value handling changed in 5.x? If yes, why?

Bo Thorsen bthorsen at ics.com
Fri May 24 08:16:58 CEST 2013


Den 24-05-2013 05:45, Constantin Makshin skrev:
> http://qt-project.org/doc/qt-4.8/qsqlquery.html#QSqlQuery-2 says the
> constructor you used executes the query passed to it.
>
> http://qt-project.org/doc/qt-4.8/qsqlquery.html#bindValue says it's
> meant to be used with prepared queries.
>
> So my opinion is that the fact that the code you used in Qt 4 worked is
> purely a coincidence showing unintended/undocumented behavior.

That still means there's a bug. Either his first code shouldn't compile, 
or it should work. That it compiles and runs but fails seems like the 
worst possible.

Guido, I think you should open a bug report on this one.

Bo.

> On May 23, 2013 1:31 AM, "Guido Seifert" <wargand at gmx.de
> <mailto:wargand at gmx.de>> wrote:
>
>
>     I am wondering.
>     I have a program, which runs perfectly fine with Qt 4.8.
>     In dozens of places I do:
>     QString queryString = "SOME SQL STATEMENT with :foo;";
>     QSqlQuery query(queryString, database);
>     query.bindValue(":foo", xxxxxx);
>     query.exec();
>
>     Now I tried to compile the program with Qt 5.1. Compiles fine,
>     but the database stuff is totally broken. Above value binding
>     does not seem to work anymore.
>
>     Now I have to do:
>     QString queryString = "SOME SQL STATEMENT with :foo;";
>     QSqlQuery query(database);
>     query.prepare(queryString);
>     query.bindValue(":foo", xxxxxx);
>     query.exec();
>
>
>     Not too difficult to change, but WHY?
>
>     Guido
>
>
>     --
>     Guido Seifert <wargand at gmx.de <mailto:wargand at gmx.de>>
>     _______________________________________________
>     Interest mailing list
>     Interest at qt-project.org <mailto:Interest at qt-project.org>
>     http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>


-- 
Bo Thorsen, European Qt Manager, Integrated Computer Solutions
ICS - Delivering World-Class Applications for Embedded & Mobile Devices
http://ics.com/services



More information about the Interest mailing list