summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-08-23 12:52:57 +0300
committerMichael Widenius <monty@askmonty.org>2010-08-23 12:52:57 +0300
commit53310c6ee7d602768998856c85519b9420820f46 (patch)
tree95ffbb4f77cca73b89f42c9555a10da251608017 /client
parentb6fe4713fe14c059c4bceca60ed1863a90b7e512 (diff)
downloadmariadb-git-53310c6ee7d602768998856c85519b9420820f46.tar.gz
Trivial fixes, more safe DBUG_ASSERT()'s and some more DBUG_
- CTRL-C now aborts 'source' commands in mysql client - Fix that thread id's are removed in convert-debug-for-diff.sh client/mysql.cc: CTRL-C now aborts 'source' commands scripts/convert-debug-for-diff.sh: Fix expression to remove thread id storage/maria/ha_maria.cc: Don't call DBUG_ASSERT() when we kill a query during REPAIR / ALTER TABLE storage/maria/ma_bitmap.c: Added DBUG_ASSERT() if we call _ma_bitmap_set_full_page_bits() storage/maria/ma_key_recover.c: Don't do an assert if table is marked crashed. storage/maria/ma_recovery.c: Added DBUG_ENTER
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc15
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;
}