From b8430baeadd62b643ff07a2588c62141146c08fd Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 15 Jun 2009 10:28:47 +1000 Subject: BT Revert "Fix the behaviour of sql classes regarding quoted identifiers" This reverts commit bb7bddc47dd0748b45d22180d9e3c8e5209010b3 due to forward binary compatibility issues in a point release. --- src/sql/drivers/sqlite/qsql_sqlite.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/sql/drivers/sqlite/qsql_sqlite.cpp') diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index f732077a93..605c4e8cd3 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -661,13 +661,9 @@ QSqlIndex QSQLiteDriver::primaryIndex(const QString &tblname) const if (!isOpen()) return QSqlIndex(); - QString table = tblname; - if (isIdentifierEscaped(table, QSqlDriver::TableName)) - table = stripDelimiters(table, QSqlDriver::TableName); - QSqlQuery q(createResult()); q.setForwardOnly(true); - return qGetTableInfo(q, table, true); + return qGetTableInfo(q, tblname, true); } QSqlRecord QSQLiteDriver::record(const QString &tbl) const @@ -675,13 +671,9 @@ QSqlRecord QSQLiteDriver::record(const QString &tbl) const if (!isOpen()) return QSqlRecord(); - QString table = tbl; - if (isIdentifierEscaped(table, QSqlDriver::TableName)) - table = stripDelimiters(table, QSqlDriver::TableName); - QSqlQuery q(createResult()); q.setForwardOnly(true); - return qGetTableInfo(q, table); + return qGetTableInfo(q, tbl); } QVariant QSQLiteDriver::handle() const @@ -689,10 +681,10 @@ QVariant QSQLiteDriver::handle() const return qVariantFromValue(d->access); } -QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const +QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType /*type*/) const { QString res = identifier; - if(!identifier.isEmpty() && !isIdentifierEscaped(identifier, type) ) { + if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); -- cgit v1.2.3