summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-09-30 12:38:51 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-09-30 12:38:51 (GMT)
commit5971b87b4786aeec29a94c4bb77427c9eb823a96 (patch)
tree03cc616ccb6921b5fcfb3fa45eb539fac6a7be01 /src
parentca2834b0056b301f1d1b732840fcb106fdd477ac (diff)
parent343eb73edaa4a05860bf8749a2ff70359f45eb78 (diff)
downloadQt-5971b87b4786aeec29a94c4bb77427c9eb823a96.zip
Qt-5971b87b4786aeec29a94c4bb77427c9eb823a96.tar.gz
Qt-5971b87b4786aeec29a94c4bb77427c9eb823a96.tar.bz2
Merge branch '4.5' of scm.dev.nokia.troll.no:qt/qt into 4.6
Conflicts: src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp src/3rdparty/webkit/WebCore/generated/CSSGrammar.h (merged webkit files with -s ours)
Diffstat (limited to 'src')
-rw-r--r--src/sql/drivers/tds/qsql_tds.cpp15
-rw-r--r--src/sql/drivers/tds/qsql_tds.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
index 46508a0..2508833 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/sql/drivers/tds/qsql_tds.cpp
@@ -754,7 +754,9 @@ QString QTDSDriver::formatValue(const QSqlField &field,
r = QLatin1String("NULL");
else if (field.type() == QVariant::DateTime) {
if (field.value().toDateTime().isValid()){
- r = field.value().toDateTime().toString(QLatin1String("'yyyyMMdd hh:mm:ss'"));
+ r = field.value().toDateTime().toString(QLatin1String("yyyyMMdd hh:mm:ss"));
+ r.prepend(QLatin1String("'"));
+ r.append(QLatin1String("'"));
} else
r = QLatin1String("NULL");
} else if (field.type() == QVariant::ByteArray) {
@@ -805,4 +807,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();