summaryrefslogtreecommitdiffstats
path: root/src/sql/drivers/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/drivers/mysql')
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp19
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.h3
2 files changed, 2 insertions, 20 deletions
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 53645c9b8d..4468686f2a 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -1342,7 +1342,7 @@ QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const
QSqlQuery i(createResult());
QString stmt(QLatin1String("show index from %1;"));
QSqlRecord fil = record(tablename);
- i.exec(stmt.arg(tablename));
+ i.exec(stmt.arg(escapeIdentifier(tablename, QSqlDriver::TableName)));
while (i.isActive() && i.next()) {
if (i.value(2).toString() == QLatin1String("PRIMARY")) {
idx.append(fil.field(i.value(4).toString()));
@@ -1357,14 +1357,10 @@ QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const
QSqlRecord QMYSQLDriver::record(const QString& tablename) const
{
- QString table=tablename;
- if(isIdentifierEscaped(table, QSqlDriver::TableName))
- table = stripDelimiters(table, QSqlDriver::TableName);
-
QSqlRecord info;
if (!isOpen())
return info;
- MYSQL_RES* r = mysql_list_fields(d->mysql, table.toLocal8Bit().constData(), 0);
+ MYSQL_RES* r = mysql_list_fields(d->mysql, tablename.toLocal8Bit().constData(), 0);
if (!r) {
return info;
}
@@ -1475,17 +1471,6 @@ QString QMYSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType
return res;
}
-bool QMYSQLDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const
-{
- Q_UNUSED(type);
- bool isLeftDelimited = (identifier.left(1) == QString(QLatin1Char('`')));
- bool isRightDelimited = (identifier.right(1) == QString(QLatin1Char('`')));
- if( identifier.size() > 2 && isLeftDelimited && isRightDelimited )
- return true;
- else
- return false;
-}
-
QT_END_NAMESPACE
#include "qsql_mysql.moc" \ No newline at end of file
diff --git a/src/sql/drivers/mysql/qsql_mysql.h b/src/sql/drivers/mysql/qsql_mysql.h
index 31d9dcf731..97aa346025 100644
--- a/src/sql/drivers/mysql/qsql_mysql.h
+++ b/src/sql/drivers/mysql/qsql_mysql.h
@@ -123,9 +123,6 @@ public:
QVariant handle() const;
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
-protected Q_SLOTS:
- bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const;
-
protected:
bool beginTransaction();
bool commitTransaction();