FS-3359 --resolve also added %y to printf macros to replace ' with \'
This commit is contained in:
parent
524dc277aa
commit
3b5a0ae50d
|
@ -150,9 +150,9 @@ static int lua_parse_and_execute(lua_State * L, char *input_code)
|
|||
switch_stream_handle_t stream = { 0 };
|
||||
SWITCH_STANDARD_STREAM(stream);
|
||||
|
||||
stream.write_function(&stream, " argv = {[0]='%s', ", input_code);
|
||||
stream.write_function(&stream, " argv = {[0]='%y', ", input_code);
|
||||
for (x = 0; x < argc; x++) {
|
||||
stream.write_function(&stream, "'%s'%s", argv[x], x == argc - 1 ? "" : ", ");
|
||||
stream.write_function(&stream, "'%y'%s", argv[x], x == argc - 1 ? "" : ", ");
|
||||
}
|
||||
stream.write_function(&stream, " };");
|
||||
code = (char *) stream.data;
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#endif
|
||||
#define etPOINTER 15 /* The %p conversion */
|
||||
#define etSQLESCAPE3 16
|
||||
#define etSQLESCAPE4 17
|
||||
|
||||
/*
|
||||
** An "etByte" is an 8-bit unsigned value.
|
||||
|
@ -127,6 +128,7 @@ static const et_info fmtinfo[] = {
|
|||
{'q', 0, 4, etSQLESCAPE, 0, 0},
|
||||
{'Q', 0, 4, etSQLESCAPE2, 0, 0},
|
||||
{'w', 0, 4, etSQLESCAPE3, 0, 0},
|
||||
{'y', 0, 4, etSQLESCAPE4, 0, 0},
|
||||
{'c', 0, 0, etCHARX, 0, 0},
|
||||
{'o', 8, 0, etRADIX, 0, 2},
|
||||
{'u', 10, 0, etRADIX, 0, 0},
|
||||
|
@ -676,6 +678,7 @@ static int vxprintf(void (*func) (void *, const char *, int), /* Consumer of tex
|
|||
break;
|
||||
case etSQLESCAPE:
|
||||
case etSQLESCAPE2:
|
||||
case etSQLESCAPE4:
|
||||
case etSQLESCAPE3:{
|
||||
int i, j, n, ch, isnull;
|
||||
int needQuote;
|
||||
|
@ -697,12 +700,20 @@ static int vxprintf(void (*func) (void *, const char *, int), /* Consumer of tex
|
|||
bufpt = buf;
|
||||
}
|
||||
j = 0;
|
||||
if (needQuote)
|
||||
if (needQuote)
|
||||
bufpt[j++] = '\'';
|
||||
for (i = 0; (ch = escarg[i]) != 0; i++) {
|
||||
bufpt[j++] = (char) ch;
|
||||
if (ch == '\'' || (xtype == etSQLESCAPE3 && ch == '\\'))
|
||||
bufpt[j++] = (char) ch;
|
||||
if (xtype == etSQLESCAPE4) {
|
||||
if (ch == '\'' || (xtype == etSQLESCAPE3 && ch == '\\')) {
|
||||
bufpt[j] = (char) ch;
|
||||
bufpt[j-1] = (char) '\\';
|
||||
j++;
|
||||
}
|
||||
} else {
|
||||
if (ch == '\'' || (xtype == etSQLESCAPE3 && ch == '\\'))
|
||||
bufpt[j++] = (char) ch;
|
||||
}
|
||||
}
|
||||
if (needQuote)
|
||||
bufpt[j++] = '\'';
|
||||
|
|
|
@ -1940,11 +1940,11 @@ static unsigned int separate_string_char_delim(char *buf, char delim, char **arr
|
|||
}
|
||||
}
|
||||
/* strip quotes, escaped chars and leading / trailing spaces */
|
||||
if (count > 1) {
|
||||
for (i = 0; i < count; ++i) {
|
||||
array[i] = cleanup_separated_string(array[i], delim);
|
||||
}
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
array[i] = cleanup_separated_string(array[i], delim);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -2000,11 +2000,11 @@ static unsigned int separate_string_blank_delim(char *buf, char **array, unsigne
|
|||
}
|
||||
}
|
||||
/* strip quotes, escaped chars and leading / trailing spaces */
|
||||
if (count > 1) {
|
||||
for (i = 0; i < count; ++i) {
|
||||
array[i] = cleanup_separated_string(array[i], 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
array[i] = cleanup_separated_string(array[i], 0);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue