[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#420477: branches/koffice/1.6/koffice/kexi/kexidb/drivers/pqxx



SVN commit 657193 by staniek:

KexiDB, Project Migration
- fixed a bug because of error in pqxx docs:
  pqxx::sqlesc() is not the same as pqxx::Quote()

CCMAIL:adam@piggz.co.uk
CCMAIL:420477@bugs.debian.org



 M  +6 -0      pqxxconnection.cpp  
 M  +6 -2      pqxxdriver.cpp  


--- branches/koffice/1.6/koffice/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp #657192:657193
@@ -290,6 +290,12 @@
 		//If all went well then return true, errors picked up by the catch block
 		ok = true;
 	}
+	catch(const pqxx::sql_error& sqlerr) {
+			KexiDBDrvDbg << "pqxxSqlConnection::drv_executeSQL: sql_error exception - " << sqlerr.query().c_str() << endl;
+  }
+	catch (const pqxx::broken_connection& bcerr) {
+			KexiDBDrvDbg << "pqxxSqlConnection::drv_executeSQL: broken_connection exception" << endl;
+  }
 	catch (const std::exception &e)
 	{
 		//If an error ocurred then put the error description into _dbError
--- branches/koffice/1.6/koffice/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp #657192:657193
@@ -133,14 +133,18 @@
 //
 QString pqxxSqlDriver::escapeString( const QString& str) const
 {
-    return QString(pqxx::sqlesc(str.ascii()).c_str());
+    return QString::fromLatin1("'")
+    	+ QString::fromAscii( pqxx::sqlesc(std::string(str.utf8())).c_str() )
+    	+ QString::fromLatin1("'");
 }
 
 //==================================================================================
 //
 QCString pqxxSqlDriver::escapeString( const QCString& str) const
 {
-    return QCString(pqxx::sqlesc(QString(str).ascii()).c_str());
+    return QCString("'")
+    	+ QCString( pqxx::sqlesc(QString(str).ascii()).c_str() )
+    	+ QCString("'");
 }
 
 //==================================================================================



Reply to: