diff options
author | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-02-05 11:04:15 +0600 |
---|---|---|
committer | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-02-05 11:04:15 +0600 |
commit | 792073a36a6202a0b7739759503c99669a7ac75a (patch) | |
tree | 8a9941779c7f7b3f3998bc65c41aeaf2f35014f0 /client/mysql.cc | |
parent | 7e34d8c3434f2effdfb99815598e45a01d208dcb (diff) | |
parent | 2f0ba4c3f82a8c621c1efaae18911d9fa868ec64 (diff) | |
download | mariadb-git-792073a36a6202a0b7739759503c99669a7ac75a.tar.gz |
Auto-merge from mysql-5.1 for bug#57450.
Diffstat (limited to 'client/mysql.cc')
-rw-r--r-- | client/mysql.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 8fea1b054f3..9ee1ca6ae1a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -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 */ |