Skip to content
Permalink
Browse files

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

Limit lines to ~16K
  • Loading branch information...
vaintroub committed Jun 25, 2019
1 parent 1a518aa commit 9e0ed0fabd960097c94e94345ffd86d0af98a28d
Showing with 11 additions and 2 deletions.
  1. +1 −1 cmake/create_initial_db.cmake
  2. +10 −1 scripts/comp_sql.c
@@ -52,7 +52,7 @@ SET(BOOTSTRAP_COMMAND
--datadir=.
--default-storage-engine=MyISAM
--max_allowed_packet=8M
--net_buffer_length=16K
--net_buffer_length=32K
)

GET_FILENAME_COMPONENT(CWD . ABSOLUTE)
@@ -74,6 +74,8 @@ char *fgets_fn(char *buffer, size_t size, fgets_input_t input, int *error)
return line;
}

#define MAX_COLUMN 16000

static void print_query(FILE *out, const char *query)
{
const char *ptr= query;
@@ -82,6 +84,12 @@ static void print_query(FILE *out, const char *query)
fprintf(out, "\"");
while (*ptr)
{
if(column >= MAX_COLUMN)
{
/* Wrap to the next line, tabulated. */
fprintf(out, "\"\n \"");
column= 2;
}
switch(*ptr)
{
case '\n':
@@ -97,10 +105,11 @@ static void print_query(FILE *out, const char *query)
break;
case '\"':
fprintf(out, "\\\"");
column++;
column+=2;
break;
case '\\':
fprintf(out, "\\\\");
column+=2;
break;
default:
putc(*ptr, out);

0 comments on commit 9e0ed0f

Please sign in to comment.
You can’t perform that action at this time.