summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2009-11-03 01:52:57 +0100
committerVladislav Vaintroub <vvaintroub@mysql.com>2009-11-03 01:52:57 +0100
commit7d5e759907e55250749e79d35a8f1bc1b6b391ad (patch)
tree4c9faaf0a5cffc8b04abfd8c697396fa72259b5f /client
parent2f075a1e37a483833e6f7e2de4bd3f9b1848082c (diff)
parentfa6c23832c6fd6c544a04d8a70f01838d451a4b0 (diff)
downloadmariadb-git-7d5e759907e55250749e79d35a8f1bc1b6b391ad.tar.gz
merge
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc28
-rw-r--r--client/mysqlbinlog.cc14
-rw-r--r--client/mysqltest.cc53
3 files changed, 57 insertions, 38 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 28da6d75c1b..b76a3d624ab 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1280,21 +1280,35 @@ sig_handler handle_sigint(int sig)
MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
- if (!executing_query || interrupted_query)
+ /* terminate if no query being executed, or we already tried interrupting */
+ if (!executing_query || (interrupted_query == 2))
+ {
+ tee_fprintf(stdout, "Ctrl-C -- exit!\n");
goto err;
+ }
kill_mysql= mysql_init(kill_mysql);
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
"", opt_mysql_port, opt_mysql_unix_port,0))
+ {
+ tee_fprintf(stdout, "Ctrl-C -- sorry, cannot connect to server to kill query, giving up ...\n");
goto err;
+ }
+
+ interrupted_query++;
+
+ /* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
+ if ((interrupted_query == 1) && (mysql_get_server_version(&mysql) < 50000))
+ interrupted_query= 2;
/* kill_buffer is always big enough because max length of %lu is 15 */
- sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
- mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
+ sprintf(kill_buffer, "KILL %s%lu",
+ (interrupted_query == 1) ? "QUERY " : "",
+ mysql_thread_id(&mysql));
+ tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
+ mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
- tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
-
- interrupted_query= 1;
+ tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
return;
@@ -2863,7 +2877,7 @@ com_help(String *buffer __attribute__((unused)),
"For developer information, including the MySQL Reference Manual, "
"visit:\n"
" http://dev.mysql.com/\n"
- "To buy MySQL Network Support, training, or other products, visit:\n"
+ "To buy MySQL Enterprise support, training, or other products, visit:\n"
" https://shop.mysql.com/\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index a5d29f92a17..f55dc75df5d 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -995,13 +995,13 @@ static struct my_option my_long_options[] =
/* 'unspec' is not mentioned because it is just a placeholder. */
"Determine when the output statements should be base64-encoded BINLOG "
"statements: 'never' disables it and works only for binlogs without "
- "row-based events; 'auto' is the default and prints base64 only when "
- "necessary (i.e., for row-based events and format description events); "
- "'decode-rows' suppresses BINLOG statements for row events, but does "
- "not exit as an error if a row event is found, unlike 'never'; "
- "'always' prints base64 whenever possible. 'always' is for debugging "
- "only and should not be used in a production system. The default is "
- "'auto'. --base64-output is a short form for --base64-output=always."
+ "row-based events; 'decode-rows' decodes row events into commented SQL "
+ "statements if the --verbose option is also given; 'auto' prints base64 "
+ "only when necessary (i.e., for row-based events and format description "
+ "events); 'always' prints base64 whenever possible. 'always' is for "
+ "debugging only and should not be used in a production system. If this "
+ "argument is not given, the default is 'auto'; if it is given with no "
+ "argument, 'always' is used."
,(uchar**) &opt_base64_output_mode_str,
(uchar**) &opt_base64_output_mode_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 635beb5fbda..cb1d21ebe8a 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -6965,35 +6965,39 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
Need to grab affected rows information before getting
warnings here
*/
- if (!disable_info)
- affected_rows= mysql_affected_rows(mysql);
-
- if (!disable_warnings)
{
- /* Get the warnings from execute */
+ ulonglong affected_rows;
+ LINT_INIT(affected_rows);
+
+ if (!disable_info)
+ affected_rows= mysql_affected_rows(mysql);
- /* Append warnings to ds - if there are any */
- if (append_warnings(&ds_execute_warnings, mysql) ||
- ds_execute_warnings.length ||
- ds_prepare_warnings.length ||
- ds_warnings->length)
+ if (!disable_warnings)
{
- dynstr_append_mem(ds, "Warnings:\n", 10);
- if (ds_warnings->length)
- dynstr_append_mem(ds, ds_warnings->str,
- ds_warnings->length);
- if (ds_prepare_warnings.length)
- dynstr_append_mem(ds, ds_prepare_warnings.str,
- ds_prepare_warnings.length);
- if (ds_execute_warnings.length)
- dynstr_append_mem(ds, ds_execute_warnings.str,
- ds_execute_warnings.length);
- }
- }
+ /* Get the warnings from execute */
- if (!disable_info)
- append_info(ds, affected_rows, mysql_info(mysql));
+ /* Append warnings to ds - if there are any */
+ if (append_warnings(&ds_execute_warnings, mysql) ||
+ ds_execute_warnings.length ||
+ ds_prepare_warnings.length ||
+ ds_warnings->length)
+ {
+ dynstr_append_mem(ds, "Warnings:\n", 10);
+ if (ds_warnings->length)
+ dynstr_append_mem(ds, ds_warnings->str,
+ ds_warnings->length);
+ if (ds_prepare_warnings.length)
+ dynstr_append_mem(ds, ds_prepare_warnings.str,
+ ds_prepare_warnings.length);
+ if (ds_execute_warnings.length)
+ dynstr_append_mem(ds, ds_execute_warnings.str,
+ ds_execute_warnings.length);
+ }
+ }
+ if (!disable_info)
+ append_info(ds, affected_rows, mysql_info(mysql));
+ }
}
end:
@@ -7777,6 +7781,7 @@ int main(int argc, char **argv)
if (!ok_to_do)
{
if (command->type == Q_SOURCE ||
+ command->type == Q_ERROR ||
command->type == Q_WRITE_FILE ||
command->type == Q_APPEND_FILE ||
command->type == Q_PERL)