diff options
Diffstat (limited to 'scripts/comp_sql.c')
-rw-r--r-- | scripts/comp_sql.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c index abd59e85bb5..56023613157 100644 --- a/scripts/comp_sql.c +++ b/scripts/comp_sql.c @@ -74,13 +74,22 @@ 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; + int column= 0; fprintf(out, "\""); while (*ptr) { + if (column >= MAX_COLUMN) + { + /* Wrap to the next line, tabulated. */ + fprintf(out, "\"\n \""); + column= 2; + } switch(*ptr) { case '\n': @@ -89,18 +98,22 @@ static void print_query(FILE *out, const char *query) and wrap to the next line, tabulated. */ fprintf(out, "\\n\"\n \""); + column= 2; break; case '\r': /* Skipped */ break; case '\"': fprintf(out, "\\\""); + column+=2; break; case '\\': fprintf(out, "\\\\"); + column+=2; break; default: putc(*ptr, out); + column++; break; } ptr++; |