SQLQuery Like problem
Solved
General and Desktop
-
The following query give the expected result from DBBrowser for SQLite
select ident, name, laty, lonx, state, country from airport where scenery_local_path like '%FOLDER NAME%' order by country, state ;
With QT SQLQuery and C++, the following code
quAddOns->prepare("select ident, name, laty, lonx, state, country from airport where scenery_local_path like :AddOn order by :Sort ;") quAddOns->bindValue(":AddOn", "%FOLDER NAME%"); quAddOns->bindValue(":Sort", "country, state" ); quAddOns-exec();
gives the correct number of result but don't sort !
If I modify (without the :Sort bind value)quAddOns->prepare("select ident, name, laty, lonx, state, country from airport where scenery_local_path like :AddOn order by country, state")
gives the expected sorted results !
If I try to insert single quote (as with DB Browser) or double quote, either inside the prepare string or in the value to bind, the result exec() is empty (but no error).
I don't understand what I am doing wrong :(
Suggestions are VERY welcome...Thanks
-
Hi and welcome to devnet,
To the best of my knowledge, bind parameters doesn't apply to elements of the query like sort.
That one you'll have to build the string with it.