1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Auto-merge from mysql-5.1 for bug#57450.

This commit is contained in:
Dmitry Shulga
2011-02-05 11:04:15 +06:00
4 changed files with 39 additions and 20 deletions

View File

@ -1839,14 +1839,13 @@ static int read_and_execute(bool interactive)
ulong line_number=0;
bool ml_comment= 0;
COMMANDS *com;
bool truncated= 0;
status.exit_status=1;
for (;;)
{
if (!interactive)
{
line=batch_readline(status.line_buff, &truncated);
line=batch_readline(status.line_buff);
/*
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
Editors like "notepad" put this marker in
@ -1909,9 +1908,13 @@ static int read_and_execute(bool interactive)
if (opt_outfile && line)
fprintf(OUTFILE, "%s\n", line);
}
if (!line) // End of file
// End of file or system error
if (!line)
{
status.exit_status=0;
if (status.line_buff && status.line_buff->error)
status.exit_status= 1;
else
status.exit_status= 0;
break;
}
@ -1932,7 +1935,8 @@ static int read_and_execute(bool interactive)
#endif
continue;
}
if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated))
if (add_line(glob_buffer, line, &in_string, &ml_comment,
status.line_buff ? status.line_buff->truncated : 0))
break;
}
/* if in batch mode, send last query even if it doesn't end with \g or go */