QSqlDriver does not support Transactions (but everything seems to be installed)
-
Hello all,
i create a connection to a local 10.1.26-MariaDB. Im using QSqlDatabase to connect to it ... everything works fine ... i can INSERT, UPDATE, SELECT .... . But if i ask with:
QSqlDatabase db = QSqlDatabase::database(); if (!db.driver()->hasFeature(QSqlDriver::Transactions))
It returns false.
My installation is following:
- Windows 7 (64bit)
- Qt5.7.0
- MySQL Workbench 6.3 CE (i link there to the libmysql.dll)
- db setup with xampp (because of this mariadb)
I really dont get whats wrong ... searching now for 8 hours but find nothing.
Thanks for you help guys,
MrEinsA
-
Thanks for the fast reply, this is my connection code:
m_dbConnection = QSqlDatabase::addDatabase("QMYSQL"); m_dbConnection.setHostName(host); m_dbConnection.setPort(port); if (!m_dbConnection.open(user, password)) { coutFRed("::connect, %s", qPrintable(m_dbConnection.lastError().text())); return false; } coutFGreen("::connect, connection active...");
-
Hi and welcome to devnet,
What version of MySQL is your server ?
-
Same to you !
Did you rebuild the Qt MySQL plugin ?
-
Not necessarily. The transaction detection is effective if the client library version used to build the plugin is greater than 3.23.34. Now the question is is, are you sure the server supports it ?
-
How were you using it ?
-
So basically if you don't do the check and use it, it works as expected ?
-
Sorry, I misunderstood you. So if you write the transaction in the SQL statement of the QSqlQuery it's working properly. Correct this time ?
-
That's not the most easy but I'd re-build the MySQL plugin to see what the check does currently.