summaryrefslogtreecommitdiff
path: root/src/sql
diff options
context:
space:
mode:
authorEmmanuel BOURGERIE <manu.dwarf@gmail.com>2011-04-27 14:04:02 +1000
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-10 12:54:49 +0200
commit02ebcdb8c765e8d9047bd8ba87af23e69e68f78d (patch)
treead0df42d923ba91853969d29b09a80f57b433e5f /src/sql
parentb1d6704b146c6ad8fd675a1cca3ab5e4e0e8b9c5 (diff)
downloadqtbase-02ebcdb8c765e8d9047bd8ba87af23e69e68f78d.tar.gz
Fixed QTBUG-11935 : "With MySQL version > 50000 the QMYSQLDriver::
tables() returns tables in all databases on the server" This bugfix has been rewritten to match contributors advise. Change-Id: I3a9cf900ff7eae47c9ffdbcf34bcb1b4396d9837 Merge-request: 1010 Reviewed-by: Charles Yin <charles.yin@nokia.com> (cherry picked from commit c0ca29efdeb442a6b88ccadff409e3f7ef828ce8)
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 37c3055ba1..4250b61a01 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -1374,16 +1374,16 @@ QStringList QMYSQLDriver::tables(QSql::TableType type) const
} else {
QSqlQuery q(createResult());
if(type & QSql::Tables) {
- QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = ':schema' and table_type = 'BASE TABLE'");
- sql.replace(QLatin1String(":schema"), QLatin1String(d->mysql->db));
+ QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = '") + QLatin1String(d->mysql->db) + QLatin1String("' and table_type = 'BASE TABLE'");
q.exec(sql);
+
while(q.next())
tl.append(q.value(0).toString());
}
if(type & QSql::Views) {
- QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = ':schema' and table_type = 'VIEW'");
- sql.replace(QLatin1String(":schema"), QLatin1String(d->mysql->db));
+ QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = '") + QLatin1String(d->mysql->db) + QLatin1String("' and table_type = 'VIEW'");
q.exec(sql);
+
while(q.next())
tl.append(q.value(0).toString());
}