mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
mdb-sql: Handle ';' as terminators in SQL input files
This commit is contained in:
parent
9c8b67b8f8
commit
eab60a6060
@ -443,15 +443,16 @@ main(int argc, char **argv)
|
|||||||
if (s) free(s);
|
if (s) free(s);
|
||||||
|
|
||||||
if (in) {
|
if (in) {
|
||||||
s=malloc(256);
|
s=malloc(bufsz);
|
||||||
if ((!s) || (!fgets(s, 256, in))) {
|
if (!fgets(s, bufsz, in)) {
|
||||||
/* if we have something in the buffer, run it */
|
// Backwards compatibility with older MDBTools
|
||||||
|
// Files read from the command line had an
|
||||||
|
// implicit "go" at the end
|
||||||
if (strlen(mybuf))
|
if (strlen(mybuf))
|
||||||
run_query((out) ? out : stdout,
|
strcpy(s, "go");
|
||||||
sql, mybuf, delimiter);
|
else
|
||||||
break;
|
break;
|
||||||
}
|
} else if (s[strlen(s)-1]=='\n')
|
||||||
if (s[strlen(s)-1]=='\n')
|
|
||||||
s[strlen(s)-1]=0;
|
s[strlen(s)-1]=0;
|
||||||
} else {
|
} else {
|
||||||
sprintf(prompt, "%d => ", line);
|
sprintf(prompt, "%d => ", line);
|
||||||
@ -483,8 +484,8 @@ main(int argc, char **argv)
|
|||||||
mybuf = (char *) g_realloc(mybuf, bufsz);
|
mybuf = (char *) g_realloc(mybuf, bufsz);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_READLINE_HISTORY
|
#ifdef HAVE_READLINE_HISTORY
|
||||||
/* don't record blank lines */
|
/* don't record blank lines, or lines read from files */
|
||||||
if (strlen(s)) add_history(s);
|
if (!in && strlen(s)) add_history(s);
|
||||||
#endif
|
#endif
|
||||||
strcat(mybuf,s);
|
strcat(mybuf,s);
|
||||||
/* preserve line numbering for the parser */
|
/* preserve line numbering for the parser */
|
||||||
|
Loading…
Reference in New Issue
Block a user