Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
5.12.2
-
None
Description
QSqlDatabase::tables() returns empty list if I connect to MYSQL database using libmysql.dll client library version 8.0.16.0.
Steps to reproduce:
1. Execute the following SQL script in MYSQL:
CREATE DATABASE mysql_test_db; USE mysql_test_db; CREATE TABLE table1 ( id integer AUTO_INCREMENT, col1 bool, col2 int, col3 text, PRIMARY KEY(id) ); CREATE TABLE table2 ( id integer AUTO_INCREMENT, col1 bool, col2 int, col3 text, PRIMARY KEY(id) );
2. Create console application with this code:
#include <QCoreApplication> #include <QString> #include <QSqlDatabase> #include <QSqlQuery> #include <QSqlError> #include <QTextStream> int main(int argc, char *argv[]) { QTextStream cout(stdout); QCoreApplication app(argc, argv); QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("localhost"); db.setDatabaseName("mysql_test_db"); db.setUserName("root"); db.setPassword("password"); if (!db.open()) { cout << "Open database error. " << db.lastError().text() << endl; return 1; } QStringList tables = db.tables(); cout << "Number of tables: " << tables.count() << endl; for (int i=0; i<tables.count(); ++i) { cout << (i+1) << "." << tables[i] << endl; } return 0; }
3. Copy libmysql.dll, libeay32.dll and ssleay32.dll to build dir.
4. Run the application.
For libmysql.dll 8.0.16.0 the output is:
Number of tables: 0
For libmysql.dll 6.1.6.0 the output is:
Number of tables: 2
1.table1
2.table2
Tested with:
MYSQL Community Server 8.0.16 x64, MYSQL Community Server 5.5.17 x86
Qt 5.12.2 MSVC 2015 x64
Windows 10 x64