Commit 9e0ed0fa authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-19860 - do not produce huge strings wtih comp_sql anymore.

Limit lines to ~16K
parent 1a518aa1
...@@ -52,7 +52,7 @@ SET(BOOTSTRAP_COMMAND ...@@ -52,7 +52,7 @@ SET(BOOTSTRAP_COMMAND
--datadir=. --datadir=.
--default-storage-engine=MyISAM --default-storage-engine=MyISAM
--max_allowed_packet=8M --max_allowed_packet=8M
--net_buffer_length=16K --net_buffer_length=32K
) )
GET_FILENAME_COMPONENT(CWD . ABSOLUTE) GET_FILENAME_COMPONENT(CWD . ABSOLUTE)
......
...@@ -74,6 +74,8 @@ char *fgets_fn(char *buffer, size_t size, fgets_input_t input, int *error) ...@@ -74,6 +74,8 @@ char *fgets_fn(char *buffer, size_t size, fgets_input_t input, int *error)
return line; return line;
} }
#define MAX_COLUMN 16000
static void print_query(FILE *out, const char *query) static void print_query(FILE *out, const char *query)
{ {
const char *ptr= query; const char *ptr= query;
...@@ -82,6 +84,12 @@ static void print_query(FILE *out, const char *query) ...@@ -82,6 +84,12 @@ static void print_query(FILE *out, const char *query)
fprintf(out, "\""); fprintf(out, "\"");
while (*ptr) while (*ptr)
{ {
if(column >= MAX_COLUMN)
{
/* Wrap to the next line, tabulated. */
fprintf(out, "\"\n \"");
column= 2;
}
switch(*ptr) switch(*ptr)
{ {
case '\n': case '\n':
...@@ -97,10 +105,11 @@ static void print_query(FILE *out, const char *query) ...@@ -97,10 +105,11 @@ static void print_query(FILE *out, const char *query)
break; break;
case '\"': case '\"':
fprintf(out, "\\\""); fprintf(out, "\\\"");
column++; column+=2;
break; break;
case '\\': case '\\':
fprintf(out, "\\\\"); fprintf(out, "\\\\");
column+=2;
break; break;
default: default:
putc(*ptr, out); putc(*ptr, out);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment