[Kexi] Postgresql and Kexi 2.2 import database working?

Adam Pigg piggz1 at gmail.com
Sat Sep 4 16:48:41 CEST 2010


Ok, so my string escaping was totally broken.  Sorry about that

If you built form source, you could apply the diff at the end of this mail 
which changes 2 lines in pqxxdriver.cpp.

This will be fixed in 2.3, and if there is going to be a 2.2.3, i'll commit it 
for that also.

Adam




On Saturday 04 September 2010 11:22:58 you wrote:
> I removed the offending data and it is working now.
> 
> The Kexi is not Irish friendly :- )
> 
> Thanks. Noli
> 
> On 9/4/10, Adam Pigg <piggz1 at gmail.com> wrote:
> > Surely i havent made a junior mistake like that!  I'll check to see if
> > something isnt being escaped, though i swear i thought it was :)
> > 
> > Adam
> > 
> > On Saturday 04 September 2010 02:42:00 Noli Sicad wrote:
> >> I think there is problem with reading the data, when the record has this
> >> entry,
> >> 
> >> Mr. Bill O'Neilly
> >> 
> >> 
> >> WARNING:  nonstandard use of \' in a string literal
> >> LINE 1: INSERT INTO customer VALUES (14,'Mr  ','Bill','O\''Neill','2...
> >> 
> >>                                                       ^
> >> 
> >> HINT:  Use '' to write quotes in strings, or use the escape string
> >> syntax (E'...').
> >> 
> >> 
> >> Noli
> >> 
> >> `````````````````````````
> >> 
> >> transaction<READ COMMITTED> committed more than once
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleRecordInternal:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >> || cursor->storeCurrentRow(data) m_sql= "SELECT o_id, o_type, o_name,
> >> 
> >> o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='barcode' AND
> >> o_type=1 LIMIT 1"
> >> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> >> "barcode_pkey" for table "barcode"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleString:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >>  "SELECT o_id FROM kexi__objects WHERE o_type=1 AND
> >> 
> >> lower(o_name)='barcode' LIMIT 1"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleRecordInternal:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >> || cursor->storeCurrentRow(data) m_sql= "SELECT o_id, o_type, o_name,
> >> 
> >> o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='customer'
> >> AND o_type=1 LIMIT 1"
> >> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> >> "customer_pkey" for table "customer"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleString:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >>  "SELECT o_id FROM kexi__objects WHERE o_type=1 AND
> >> 
> >> lower(o_name)='customer' LIMIT 1"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleRecordInternal:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >> || cursor->storeCurrentRow(data) m_sql= "SELECT o_id, o_type, o_name,
> >> 
> >> o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='item' AND
> >> o_type=1 LIMIT 1"
> >> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> >> "item_pkey" for table "item"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleString:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >>  "SELECT o_id FROM kexi__objects WHERE o_type=1 AND
> >> 
> >> lower(o_name)='item' LIMIT 1"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleRecordInternal:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >> || cursor->storeCurrentRow(data) m_sql= "SELECT o_id, o_type, o_name,
> >> 
> >> o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='orderinfo'
> >> AND o_type=1 LIMIT 1"
> >> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> >> "orderinfo_pkey" for table "orderinfo"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleString:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >>  "SELECT o_id FROM kexi__objects WHERE o_type=1 AND
> >> 
> >> lower(o_name)='orderinfo' LIMIT 1"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleRecordInternal:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >> || cursor->storeCurrentRow(data) m_sql= "SELECT o_id, o_type, o_name,
> >> 
> >> o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='orderline'
> >> AND o_type=1 LIMIT 1"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleString:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >>  "SELECT o_id FROM kexi__objects WHERE o_type=1 AND
> >> 
> >> lower(o_name)='orderline' LIMIT 1"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleRecordInternal:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >> || cursor->storeCurrentRow(data) m_sql= "SELECT o_id, o_type, o_name,
> >> 
> >> o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='stock' AND
> >> o_type=1 LIMIT 1"
> >> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> >> "stock_pkey" for table "stock"
> >> kexi(7247)/KexiDB KexiDB::Connection::querySingleString:
> >> Connection::querySingleRecord(): !cursor->moveFirst() || cursor->eof()
> >> 
> >>  "SELECT o_id FROM kexi__objects WHERE o_type=1 AND
> >> 
> >> lower(o_name)='stock' LIMIT 1"
> >> transaction<READ COMMITTED> committed more than once
> >> WARNING:  nonstandard use of \' in a string literal
> >> LINE 1: INSERT INTO customer VALUES (14,'Mr  ','Bill','O\''Neill','2...
> >> 
> >>                                                       ^
> >> 
> >> HINT:  Use '' to write quotes in strings, or use the escape string
> >> syntax (E'...').


Index: .
===================================================================
--- .	(revision 1171566)
+++ .	(working copy)
@@ -136,11 +136,14 @@
            + QString::fromLatin1("'");
 */
 //TODO Optimize
-           return QString::fromLatin1("'") + QString(str)
+//           return QString::fromLatin1("'") + QString(str)
            /*.replace('\\', "\\\\")*/
-           .replace('\'', "\\''")
-           .replace('"', "\\\"")
-           + QString::fromLatin1("'");
+//           .replace('\'', "\\''")
+ //          .replace('"', "\\\"")
+ //          + QString::fromLatin1("'");
+
+return QString::fromLatin1("E'") + QString(str).replace("'", 
"\"\"").replace("\\", "\\\\") + QString::fromLatin1("'");
+  
 }
 
 //==================================================================================
@@ -156,11 +159,14 @@
     + QByteArray(_internalWork->esc(str).c_str())
            + QByteArray("'");*/
 
-    return QByteArray("'") + QByteArray(str)
+//    return QByteArray("'") + QByteArray(str)
            /*.replace('\\', "\\\\")*/
-           .replace('\'', "\\''")
-           .replace('"', "\\\"")
-           + QByteArray("'");
+//           .replace('\'', "\\''")
+//           .replace('"', "\\\"")
+//           + QByteArray("'");
+
+    return QByteArray("E'") + QByteArray(str).replace("'", 
"\"\"").replace("\\", "\\\\") + QByteArray("'");
+
 }
 
 //==================================================================================


More information about the Kexi mailing list