diff options
author | Michael Widenius <monty@askmonty.org> | 2010-08-24 20:42:59 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-08-24 20:42:59 +0300 |
commit | 918b25ec7ef208ece958d858cf03eb36033be2b7 (patch) | |
tree | 255f43155dfe1f657f45dae3804f1b0cc815e232 /client | |
parent | ced635391ef9368276eddf6b490f6d969a40cef4 (diff) | |
parent | 190ed5a23e9ee96aff31b6f4598294cd9efd9f13 (diff) | |
download | mariadb-git-918b25ec7ef208ece958d858cf03eb36033be2b7.tar.gz |
Automatic merge
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index fb090cd74d5..39ca04ccbb9 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -156,6 +156,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0, static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error; static my_bool column_types_flag; static my_bool preserve_comments= 0; +static my_bool in_com_source, aborted= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static uint my_end_arg; @@ -1087,6 +1088,7 @@ int main(int argc,char *argv[]) "\\N [\\d]> ",MYF(MY_WME)); current_prompt = my_strdup(default_prompt,MYF(MY_WME)); prompt_counter=0; + aborted= 0; outfile[0]=0; // no (default) outfile strmov(pager, "stdout"); // the default, if --pager wasn't given @@ -1281,8 +1283,10 @@ sig_handler mysql_end(int sig) /* This function handles sigint calls If query is in process, kill query + If 'source' is executed, abort source command no query in process, terminate like previous behavior */ + sig_handler handle_sigint(int sig) { char kill_buffer[40]; @@ -1321,7 +1325,8 @@ sig_handler handle_sigint(int sig) mysql_close(kill_mysql); tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n"); interrupted_query= 0; - + if (in_com_source) + aborted= 1; // Abort source command return; err: @@ -1886,7 +1891,7 @@ static int read_and_execute(bool interactive) bool truncated= 0; status.exit_status=1; - for (;;) + while (!aborted) { if (!interactive) { @@ -4066,17 +4071,19 @@ static int com_source(String *buffer, char *line) status.file_name=source_name; glob_buffer.length(0); // Empty command buffer ignore_errors= !batch_abort_on_error; + in_com_source= 1; error= read_and_execute(false); ignore_errors= save_ignore_errors; status=old_status; // Continue as before + in_com_source= aborted= 0; my_fclose(sql_file,MYF(0)); batch_readline_end(line_buff); /* If we got an error during source operation, don't abort the client if ignore_errors is set */ - if (error && batch_abort_on_error && ignore_errors) - error= -1; + if (error && !batch_abort_on_error && ignore_errors) + error= -1; // Ignore error return error; } |