SQL/MySQL: honor schema when retrieving table record
Honor the schema when retrieving the table record - otherwise we might end up getting the data for the wrong table (same tablename but wrong schema). Fixes: QTBUG-127129 Task-number: QTBUG-122723 Change-Id: Ia3e9293dbdc77da760dd4d0702104048187fad5f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit 920dfb2f443042777ea9547ff7a8beef56e90d92) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
49193d4afd
commit
0ff64a5b99
@ -1508,7 +1508,8 @@ QSqlRecord QMYSQLDriver::record(const QString &tablename) const
|
||||
return r;
|
||||
// no binding of WHERE possible with MySQL
|
||||
// escaping on WHERE clause does not work, so use mysql_real_escape_string()
|
||||
stmt = "SELECT column_name, column_default FROM information_schema.columns WHERE table_name = '%1'"_L1;
|
||||
stmt = "SELECT column_name, column_default FROM information_schema.columns WHERE table_schema = '"_L1
|
||||
+ d->dbName + "' AND table_name = '%1'"_L1;
|
||||
const auto baTableName = tablename.toUtf8();
|
||||
QVarLengthArray<char> tableNameQuoted(baTableName.size() * 2 + 1);
|
||||
#if defined(MARIADB_VERSION_ID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user