diff options
| author | Vladislav Vaintroub <wlad@mariadb.com> | 2019-06-25 23:53:09 +0200 |
|---|---|---|
| committer | Vladislav Vaintroub <wlad@mariadb.com> | 2019-06-25 23:53:42 +0200 |
| commit | 9e0ed0fabd960097c94e94345ffd86d0af98a28d (patch) | |
| tree | 1be0e47c65e52b5776eac37f9ee61fd87c931327 /scripts/comp_sql.c | |
| parent | 1a518aa1d297dd8bbbf1898e799bc274c9ef66ba (diff) | |
| download | mariadb-git-9e0ed0fabd960097c94e94345ffd86d0af98a28d.tar.gz | |
MDEV-19860 - do not produce huge strings wtih comp_sql anymore.
Limit lines to ~16K
Diffstat (limited to 'scripts/comp_sql.c')
| -rw-r--r-- | scripts/comp_sql.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c index 748b2320f2a..5cd5642c9d0 100644 --- a/scripts/comp_sql.c +++ b/scripts/comp_sql.c @@ -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); |
