posgresql escaping in Kexi

Jaroslaw Staniek staniek at kde.org
Wed Apr 10 14:14:17 BST 2013


A possible patch:

--- a/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp
+++ b/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp
@@ -142,7 +142,7 @@ QString pqxxSqlDriver::escapeString(const QString&
str) const
  //          .replace('"', "\\\"")
  //          + QString::fromLatin1("'");

-return QString::fromLatin1("E'") + QString(str).replace("'",
"\"\"").replace("\\", "\\\\") + QString::fromLatin1("'");
+return QString::fromLatin1("E'") + QString(str).replace("'",
"''").replace("\\", "\\\\") + QString::fromLatin1("'");

 }

@@ -165,7 +165,7 @@ QByteArray pqxxSqlDriver::escapeString(const
QByteArray& str) const
 //           .replace('"', "\\\"")
 //           + QByteArray("'");

-    return QByteArray("E'") + QByteArray(str).replace("'",
"\"\"").replace("\\", "\\\\") + QByteArray("'");
+    return QByteArray("E'") + QByteArray(str).replace("'",
"''").replace("\\", "\\\\") + QByteArray("'");

 }

-- 
regards / pozdrawiam, Jaroslaw Staniek
 Kexi & Calligra & KDE | http://calligra.org/kexi | http://kde.org
 Qt Certified Specialist | http://qt-project.org
 http://www.linkedin.com/in/jstaniek



More information about the calligra-devel mailing list