Escape string

Forum for posting problems using QxOrm library

Escape string

Postby ruddy32 » Sun Mar 13, 2011 11:23 pm

Hi,
Is necessary to escape '\' character before insert or update data using trigger? Does Qt or QxOrm do it automatically? Is it necessary to use special classes?
Thanks
ruddy32
 

Re: Escape string

Postby QxOrm admin » Mon Mar 14, 2011 8:22 am

Hi,

You don't have to escape any character (using trigger or not using trigger).
What is exactly your problem ? Can you give a sample of code please ?
QxOrm admin
 

Re: Escape string

Postby ruddy32 » Mon Mar 14, 2011 9:00 am

I'm saving a regular expression using a QString object, and I get the following message:
Code: Select all
HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
ruddy32
 

Re: Escape string

Postby ruddy32 » Mon Mar 14, 2011 9:11 am

I setup the object using this code :
Code: Select all
namespace qx {

template<>
void register_class(QxClass<sdbs::ifs::MyObjEntity> & t) {
   IxDataMember * pData = NULL;

   t.setName("myobj");
   pData = t.id(&sdbs::ifs::MyObjEntity::m_id, "myobj_id", 1);
   pData->setAutoIncrement(false);
   pData = t.data(&sdbs::ifs::MyObjEntity::m_status, "myobj_status", 1);
   pData = t.data(&sdbs::ifs::MyObjEntity::m_content,  "myobj_content", 1);
}
}

The "myobj_content" column is a regular expression and sometimes it's content include '\' character.
ruddy32
 

Re: Escape string

Postby QxOrm admin » Mon Mar 14, 2011 10:41 am

What is your database type : Postgres, MySql, SQLite, other ?
What is your column type in the database to map the property 'sdbs::ifs::MyObjEntity::m_content' ?

I think this is a specific case with your database or your column definition.
First, you can try to modify your column definition in the database : try the BLOB type if exists (???) or other...
QxOrm admin
 

Re: Escape string

Postby ruddy32 » Mon Mar 14, 2011 12:07 pm

I'm using postgres 8.4. The current field type is 'text'. Would it be better to use a 'bytea' ?
ruddy32
 

Re: Escape string

Postby QxOrm admin » Mon Mar 14, 2011 1:21 pm

It seems this is a warning from postgres database (you can search it on google) :
http://dbaspot.com/forums/postgresql/25 ... acter.html

Here a solution from the website below :

* Edit postgresql.conf
* Set :
standard_conforming_strings = on
and restart the server.

Or you can also set (but it seems this is not recommended) :
escape_string_warning = off
QxOrm admin
 


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 12 guests