Solved Set QSqlDatabase driver for already created QSqlQuery. How?
-
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)
-
@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.
-
Pass the correct QSqlQuery to a function which does the binding or pass the database to this function.
-
@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.