From fc311cc623193ee936b73f487568ae86f1f9a95c Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Wed, 12 Dec 2012 22:31:03 +0530 Subject: Bug#13639125 DELIMITER STRIPS THE NEXT NEW LINE IN A SQL STATEMENT While processing each lines entered at the prompt, mysql client appends a '\n' to all the lines except for delimiter commands. However the same logic must not apply if 'delimiter' is part of a string or a comment, for which a '\n' should be added. Fixed by adding appropriate checks. Added a test case. --- client/mysql.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'client/mysql.cc') diff --git a/client/mysql.cc b/client/mysql.cc index b772fe67cc4..edbfd532de3 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2283,17 +2283,19 @@ static bool add_line(String &buffer,char *line,char *in_string, { uint length=(uint) (out-line); - if (!truncated && - (length < 9 || - my_strnncoll (charset_info, - (uchar *)line, 9, (const uchar *) "delimiter", 9))) + if (!truncated && (length < 9 || + my_strnncoll (charset_info, (uchar *)line, 9, + (const uchar *) "delimiter", 9) || + (*in_string || *ml_comment))) { /* Don't add a new line in case there's a DELIMITER command to be added to the glob buffer (e.g. on processing a line like ";DELIMITER ") : similar to how a new line is not added in the case when the DELIMITER is the first command - entered with an empty glob buffer. + entered with an empty glob buffer. However, if the delimiter is + part of a string or a comment, the new line should be added. (e.g. + SELECT '\ndelimiter\n';\n) */ *out++='\n'; length++; -- cgit v1.2.1 From e03e9aab7304395575d8ae3a54835fec854dd872 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 20 Feb 2013 14:52:43 +0100 Subject: MDEV-4181 : ensure mysql client's beep works on all Windows systems. Use MessageBeep, which employs sound card, rather than system speaker. The secondary benefit is that one can use volume control for this sound (see MySQL's Bug #17088) --- client/mysql.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'client/mysql.cc') diff --git a/client/mysql.cc b/client/mysql.cc index 67878b36227..70c0815ea76 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -4723,7 +4723,13 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) if (info_type == INFO_ERROR) { if (!opt_nobeep) + { +#ifdef _WIN32 + MessageBeep(MB_ICONWARNING); +#else putchar('\a'); /* This should make a bell */ +#endif + } vidattr(A_STANDOUT); if (error) { -- cgit v1.2.1