diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sql/drivers/tds/qsql_tds.cpp | 11 | ||||
-rw-r--r-- | src/sql/drivers/tds/qsql_tds.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index 005905b..dddc1b4 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -794,4 +794,15 @@ QSqlIndex QTDSDriver::primaryIndex(const QString& tablename) const return idx; } +QString QTDSDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const +{ + QString res = identifier; + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { + res.replace(QLatin1Char('"'), QLatin1String("\"\"")); + res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); + res.replace(QLatin1Char('.'), QLatin1String("\".\"")); + } + return res; +} + QT_END_NAMESPACE diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h index 6001106..0ceae6d 100644 --- a/src/sql/drivers/tds/qsql_tds.h +++ b/src/sql/drivers/tds/qsql_tds.h @@ -116,6 +116,8 @@ public: bool trimStrings) const; QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + protected: bool beginTransaction(); bool commitTransaction(); |