Fixed QTBUG-11935
authorEmmanuel BOURGERIE <manu.dwarf@gmail.com>
Wed, 27 Apr 2011 04:04:00 +0000 (14:04 +1000)
committerOlivier Goffart <olivier.goffart@nokia.com>
Tue, 10 May 2011 10:54:49 +0000 (12:54 +0200)
Change-Id: Ia7bdb0ceecf2892f6be73d1816764a2bab6275f1
Merge-request: 1010
Reviewed-by: Charles Yin <charles.yin@nokia.com>
(cherry picked from commit a18f36048aa23fb088527c26274e49ce626ddf4d)

src/sql/drivers/mysql/qsql_mysql.cpp

index 49e7f13..37c3055 100644 (file)
@@ -1374,12 +1374,16 @@ QStringList QMYSQLDriver::tables(QSql::TableType type) const
     } else {
         QSqlQuery q(createResult());
         if(type & QSql::Tables) {
-            q.exec(QLatin1String("select table_name from information_schema.tables where table_type = 'BASE TABLE'"));
+            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));
+            q.exec(sql);
             while(q.next())
                 tl.append(q.value(0).toString());
         }
         if(type & QSql::Views) {
-            q.exec(QLatin1String("select table_name from information_schema.tables where table_type = 'VIEW'"));
+            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));
+            q.exec(sql);
             while(q.next())
                 tl.append(q.value(0).toString());
         }