I think you're trying to solve a fake problem here :
PQescapeStringConn does the job as required, there is no problem except a 
warning.

The reason for this is the following :
You're asking postgresql to :
- Use non-standard conforming strings (aka old postgresql way of doing things)
- Do a conversion of your string (containing a \) to the string format that 
should be used -> a second \ is added
- Then insert this string, asking postgresql to warn you when you use 
non-standard conforming string. Of course, the server tells you you have an 
escaped \...

You're not explicitely asking for it, it's the default setup ...

What I think is the right way of solving the problem is this one ...

We KNOW we use the right conversion function : we use the conversion function 
provided by postgresql, and this function reads the 
standard_conforming_string value for the session used, and does what's 
required to have the data in the right format. Of course, it doesn't prevent 
the server from whining because your string isn't beautiful :)

We therefore have three solutions :
- either we tell postgresql to stop whining (we disable escape_string_warning) 
at the session level (it only means sending a 'set escape_string_warning to 
off' as we start the session)
- we enable standard_conforming_strings ('set standard_conforming_string to 
on')
- we put in the documentation the prerequisite that the administrator sets one 
of those (I don't like this one, as we can do it ourselves)

In both cases, the code will just work, with every version of postgresql...
We just have to set one of theses values if they exist... AND use 
PQescapeStringConn and not PQescapeString.
The difference between both of them is that the first one takes 
standard_conforming_strings into account.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to