Problems with the "\" character
Posted: 19.05.2016, 21:04
Hello gentlemen!
First, forgive my English!
I'm having a problem with 7.2.1-rc version that did not occur in version 7.1.4-stable: SQL statements containing strings with the "\" character.
For example, when opening a ZQuery with this SQL, the parameters are not replaced by values:
SELECT (
'VALUE1 = ' || :param1 || '\r\n' ||
'VALUE2 = ' || :param2
) AS my_text;
Generating, therefore, the following error:
ERROR: syntax error at or near ":"
LINE 1: SELECT ( 'VALUE1 = ' || :param1 || '\r\n' || 'VALUE2 = ' || ...
For it to work, I'm having to do this:
SELECT (
'VALUE1 = ' || :param1 || CHR(13) || CHR(10) ||
'VALUE2 = ' || :param2
) AS my_text;
This way works perfectly!
In 7.1.4 version, the first way also worked perfectly.
What I did was just upgrade to the 7.2.1-rc version. I did not ANY changes in the database settings and changed NOTHING in my application.
I've tried on and off the property "standard_conforming_strings" in ZConnection, but the problem persists.
Of course, if I replace this '\r\n' for this '\\r\\n', the error does not occur, but a line break is not generated.
Can someone help me?
Thank you very much!
First, forgive my English!
I'm having a problem with 7.2.1-rc version that did not occur in version 7.1.4-stable: SQL statements containing strings with the "\" character.
For example, when opening a ZQuery with this SQL, the parameters are not replaced by values:
SELECT (
'VALUE1 = ' || :param1 || '\r\n' ||
'VALUE2 = ' || :param2
) AS my_text;
Generating, therefore, the following error:
ERROR: syntax error at or near ":"
LINE 1: SELECT ( 'VALUE1 = ' || :param1 || '\r\n' || 'VALUE2 = ' || ...
For it to work, I'm having to do this:
SELECT (
'VALUE1 = ' || :param1 || CHR(13) || CHR(10) ||
'VALUE2 = ' || :param2
) AS my_text;
This way works perfectly!
In 7.1.4 version, the first way also worked perfectly.
What I did was just upgrade to the 7.2.1-rc version. I did not ANY changes in the database settings and changed NOTHING in my application.
I've tried on and off the property "standard_conforming_strings" in ZConnection, but the problem persists.
Of course, if I replace this '\r\n' for this '\\r\\n', the error does not occur, but a line break is not generated.
Can someone help me?
Thank you very much!