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 (in) {
|
||||
s=malloc(256);
|
||||
if ((!s) || (!fgets(s, 256, in))) {
|
||||
/* if we have something in the buffer, run it */
|
||||
s=malloc(bufsz);
|
||||
if (!fgets(s, bufsz, in)) {
|
||||
// Backwards compatibility with older MDBTools
|
||||
// Files read from the command line had an
|
||||
// implicit "go" at the end
|
||||
if (strlen(mybuf))
|
||||
run_query((out) ? out : stdout,
|
||||
sql, mybuf, delimiter);
|
||||
break;
|
||||
}
|
||||
if (s[strlen(s)-1]=='\n')
|
||||
strcpy(s, "go");
|
||||
else
|
||||
break;
|
||||
} else if (s[strlen(s)-1]=='\n')
|
||||
s[strlen(s)-1]=0;
|
||||
} else {
|
||||
sprintf(prompt, "%d => ", line);
|
||||
@ -483,8 +484,8 @@ main(int argc, char **argv)
|
||||
mybuf = (char *) g_realloc(mybuf, bufsz);
|
||||
}
|
||||
#ifdef HAVE_READLINE_HISTORY
|
||||
/* don't record blank lines */
|
||||
if (strlen(s)) add_history(s);
|
||||
/* don't record blank lines, or lines read from files */
|
||||
if (!in && strlen(s)) add_history(s);
|
||||
#endif
|
||||
strcat(mybuf,s);
|
||||
/* preserve line numbering for the parser */
|
||||
|
Loading…
Reference in New Issue
Block a user