From 92c26d3f9eb01f104e2b1b5c531e90b35b65c62b Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 6 Sep 2011 07:24:53 +0000 Subject: [PATCH] Sql: Fixed string escapment of PGSQL strings git-svn-id: svn://ultimatepp.org/upp/trunk@3828 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/RichText/EncodeQtf.cpp | 3 +++ uppsrc/RichText/ParseQtf.cpp | 8 +++++++- uppsrc/Sql/SqlCase.cpp | 10 ++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/uppsrc/RichText/EncodeQtf.cpp b/uppsrc/RichText/EncodeQtf.cpp index f55c6143f..0ccf310e3 100644 --- a/uppsrc/RichText/EncodeQtf.cpp +++ b/uppsrc/RichText/EncodeQtf.cpp @@ -552,6 +552,9 @@ String DeQtfLf(const char *s) { else if(*s == '\n') r.Cat('&'); + else + if(*s == '\t') + r.Cat("-|"); s++; } return r; diff --git a/uppsrc/RichText/ParseQtf.cpp b/uppsrc/RichText/ParseQtf.cpp index 23e31abba..d7ffe40ae 100644 --- a/uppsrc/RichText/ParseQtf.cpp +++ b/uppsrc/RichText/ParseQtf.cpp @@ -896,12 +896,18 @@ void RichQtfParser::Parse(const char *qtf, int _accesskey) EndPart(); SetFormat(); const char *b = ++term; - for(; *term && *term != '\1'; term++) + for(; *term && *term != '\1'; term++) { if((byte)*term == '\n') { text.Cat(ToUnicode(b, (int)(term - b), format.charset)); EndPart(); b = term + 1; } + if((byte)*term == '\t') { + text.Cat(ToUnicode(b, (int)(term - b), format.charset)); + text.Cat(9); + b = term + 1; + } + } text.Cat(ToUnicode(b, (int)(term - b), format.charset)); if(*term == '\1') term++; diff --git a/uppsrc/Sql/SqlCase.cpp b/uppsrc/Sql/SqlCase.cpp index 7f2ed20cb..52605ae13 100644 --- a/uppsrc/Sql/SqlCase.cpp +++ b/uppsrc/Sql/SqlCase.cpp @@ -201,13 +201,15 @@ void SqlCompile(const char *&s, StringBuffer *r, byte dialect) else if(c == '\r') r->Cat("\\r"); + else + if(c == '\t') + r->Cat("\\t"); else { char h[4]; - int q = (byte)*s; h[0] = '\\'; - h[1] = (3 & (q >> 6)) + '0'; - h[2] = (7 & (q >> 3)) + '0'; - h[3] = (7 & q) + '0'; + h[1] = (3 & (c >> 6)) + '0'; + h[2] = (7 & (c >> 3)) + '0'; + h[3] = (7 & c) + '0'; r->Cat(h, 4); } }