diff options
author | Chad MILLER <chad@mysql.com> | 2008-12-11 12:46:20 -0500 |
---|---|---|
committer | Chad MILLER <chad@mysql.com> | 2008-12-11 12:46:20 -0500 |
commit | a633e0b98d0dbd5aab04901856dfd717b916a508 (patch) | |
tree | 186a712bab08112017b7d95af55abc0a8847fea6 /client | |
parent | 32c1790ba873d528e36b3b6bef34cc7c0cf20362 (diff) | |
parent | d84690c92d165e0335da16a7e95b10ac5684420e (diff) | |
download | mariadb-git-a633e0b98d0dbd5aab04901856dfd717b916a508.tar.gz |
Merge fix for Bug 33812 from 5.0-bugteam.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index ff53d623d07..ed80e298897 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2020,7 +2020,7 @@ static bool add_line(String &buffer,char *line,char *in_string, { if (!preserve_comments) { - // Skip spaces at the beggining of a statement + // Skip spaces at the beginning of a statement if (my_isspace(charset_info,inchar) && (out == line) && buffer.is_empty()) continue; @@ -2103,37 +2103,6 @@ static bool add_line(String &buffer,char *line,char *in_string, continue; } } - else if (!*ml_comment && !*in_string && - (end_of_line - pos) >= 10 && - !my_strnncoll(charset_info, (uchar*) pos, 10, - (const uchar*) "delimiter ", 10)) - { - // Flush previously accepted characters - if (out != line) - { - buffer.append(line, (uint32) (out - line)); - out= line; - } - - // Flush possible comments in the buffer - if (!buffer.is_empty()) - { - if (com_go(&buffer, 0) > 0) // < 0 is not fatal - DBUG_RETURN(1); - buffer.length(0); - } - - /* - Delimiter wants the get rest of the given line as argument to - allow one to change ';' to ';;' and back - */ - buffer.append(pos); - if (com_delimiter(&buffer, pos) > 0) - DBUG_RETURN(1); - - buffer.length(0); - break; - } else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter)) { // Found a statement. Continue parsing after the delimiter @@ -2196,8 +2165,24 @@ static bool add_line(String &buffer,char *line,char *in_string, // comment to end of line if (preserve_comments) + { + bool started_with_nothing= !buffer.length(); + buffer.append(pos); + /* + A single-line comment by itself gets sent immediately so that + client commands (delimiter, status, etc) will be interpreted on + the next line. + */ + if (started_with_nothing) + { + if (com_go(&buffer, 0) > 0) // < 0 is not fatal + DBUG_RETURN(1); + buffer.length(0); + } + } + break; } else if (!*in_string && inchar == '/' && *(pos+1) == '*' && |