Sql: Fixed string escapment of PGSQL strings

git-svn-id: svn://ultimatepp.org/upp/trunk@3828 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-09-06 07:24:53 +00:00
parent d5727dfa95
commit 92c26d3f9e
3 changed files with 16 additions and 5 deletions

View file

@ -552,6 +552,9 @@ String DeQtfLf(const char *s) {
else
if(*s == '\n')
r.Cat('&');
else
if(*s == '\t')
r.Cat("-|");
s++;
}
return r;

View file

@ -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++;

View file

@ -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);
}
}