[Qt 5.2 msvc x64] QMYSQL invalid driver handle
-
Hello all, as this is my first post :)
Ad meritum:
QMYSQL driver return incorrect driver handle (i think), as following snippet throws "read access voilation" exception with mysql_ping function:
@
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "initialConnection");
if(!db.isValid())
{
qCritical() << "Initial connection invalid!";
return QStringList();
}
db.setHostName("192.168.1.2");
db.setPort(3306);
db.setUserName("kOf_GetUsers");
db.setPassword("");
db.setDatabaseName("kOferta");
db.setConnectOptions("CLIENT_SSL=1;CLIENT_IGNORE_SPACE=1;MYSQL_OPT_RECONNECT=1");qDebug() << "connName:" << db.connectionName();
qDebug() << "driver:" << db.driverName();
qDebug() << "options:" << db.connectOptions();
qDebug() << "host:" << db.hostName();
qDebug() << "database error:" << db.lastError().databaseText();
qDebug() << "driver error:" << db.lastError().driverText();QSqlDriver* driver = db.driver();
qDebug() << "driver info";
driver->dumpObjectInfo();
driver->dumpObjectTree();QVariant v = driver->handle();
if (v.isValid() && qstrcmp(v.typeName(), "MYSQL*")==0)
{
qDebug() << "v.typename:" << v.typeName();MYSQL *handle = static_cast<MYSQL *>(v.data()); if (handle != NULL) { qDebug() << "handle:" << handle; qDebug() << "mysql error:" << mysql_error(handle); try { qDebug() << "mysql ping:" << mysql_ping(handle); qDebug() << "mysql error:" << mysql_error(handle); // mysql_ssl_set(handle, ":/client-key", ":/client-cert", ":/ca-cacert", NULL, NULL); // mysql_ssl_set(handle, "D:/git/build-kOferta/client-key.pem", "D:/git/build-kOferta/client-cert.pem", "D:/git/build-kOferta/ca-cacert.pem", "D:/git/build-kOferta/", "DHE-RSA-AES256-SHA"); } catch (std::exception& e) { qCritical() << "[mysql_ssl_set] Standard exception: " << e.what(); } catch(...) { qCritical() << "[mysql_ssl_set] Unknown exception"; } }
}
@
And my log is as follows:
@
[28.12.2013 11:09:47]: connName: "initialConnection"
[28.12.2013 11:09:47]: driver: "QMYSQL"
[28.12.2013 11:09:47]: options: "CLIENT_SSL=1;CLIENT_IGNORE_SPACE=1;MYSQL_OPT_RECONNECT=1"
[28.12.2013 11:09:47]: host: "192.168.1.2"
[28.12.2013 11:09:47]: database error: ""
[28.12.2013 11:09:47]: driver error: ""
[28.12.2013 11:09:47]: driver info
[28.12.2013 11:09:47]: OBJECT QMYSQLDriver::unnamed
[28.12.2013 11:09:47]: SIGNALS OUT
[28.12.2013 11:09:47]: <None>
[28.12.2013 11:09:47]: SIGNALS IN
[28.12.2013 11:09:47]: <None>
[28.12.2013 11:09:47]: QMYSQLDriver::
[28.12.2013 11:09:47]: v.typename: MYSQL*
[28.12.2013 11:09:47]: handle: 0x2c99f0
[28.12.2013 11:09:47]: mysql error:
@What else can i check? What may be the cause? I use libmysql from MySQL Connector C 6.1 6.1.2 - i dont know if it is relevant...
Best regards, konserw
-
ok, it's bug in QMYSQL:
https://bugreports.qt-project.org/browse/QTBUG-3500#comment-226912