Set QSqlDatabase driver for already created QSqlQuery. How?
-
wrote on 22 Dec 2019, 14:03 last edited by
Hello all!
Here the creating QSqlQuery within Db-driver inside:QSqlQuery Query(DBDriver);
The question is how to setup driver for already existed QSqlQuery object? I found only getting info about current driver in use but not setting it up for existed query object. Something like this:
QSqlQuery Query(); Query.setDriver(DBDriver);
-
This is not possible (why and how should this be possible)
-
This is not possible (why and how should this be possible)
wrote on 22 Dec 2019, 14:46 last edited by bogong@Christian-Ehrlicher I have few DBs inside of application and there need to be executed one SQL String. And I am seeking solution. One of possible ideas - delivering QSqlQuery object to different DB drivers and execute it, because I don't want to be preparing for each of them SQL Query string.
-
Lifetime Qt Championwrote on 22 Dec 2019, 16:21 last edited by Christian Ehrlicher
Pass the correct QSqlQuery to a function which does the binding or pass the database to this function.
-
Pass the correct QSqlQuery to a function which does the binding or pass the database to this function.
wrote on 22 Dec 2019, 17:36 last edited by@Christian-Ehrlicher Thx for reply. That is the thing - I can pass into function only string, it's already developed before me or I need to refactor half of application backend. I think will open DB object pointer and use in constructing query outside of the function. Issue closed.
5/5