diff options
-rw-r--r-- | client/mysql.cc | 31 | ||||
-rw-r--r-- | mysql-test/r/client_xml.result | 1 | ||||
-rw-r--r-- | mysql-test/r/mysql.result | 2 | ||||
-rw-r--r-- | mysql-test/t/client_xml.test | 3 | ||||
-rw-r--r-- | mysql-test/t/mysql_delimiter.sql | 6 | ||||
-rw-r--r-- | mysys/default.c | 2 |
6 files changed, 36 insertions, 9 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 73e8973c097..024194d81f6 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2101,6 +2101,37 @@ 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 diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result index 6e9857c2d6d..aa4bdb2bd61 100644 --- a/mysql-test/r/client_xml.result +++ b/mysql-test/r/client_xml.result @@ -1,5 +1,6 @@ set @old_concurrent_insert= @@global.concurrent_insert; set @@global.concurrent_insert= 0; +drop table if exists t1; create table t1 ( `a&b` int, `a<b` int, diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 6fe35d5c9f9..a4d96c1c243 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -38,8 +38,6 @@ t2 t3 Tables_in_test t1 -delimiter -1 _ Test delimiter : from command line a diff --git a/mysql-test/t/client_xml.test b/mysql-test/t/client_xml.test index 889861ad4a4..739b56f5ab1 100644 --- a/mysql-test/t/client_xml.test +++ b/mysql-test/t/client_xml.test @@ -6,6 +6,9 @@ # the data is actually in the table). set @old_concurrent_insert= @@global.concurrent_insert; set @@global.concurrent_insert= 0; +--disable_warnings +drop table if exists t1; +--enable_warnings # Test of the xml output of the 'mysql' and 'mysqldump' clients -- makes # sure that basic encoding issues are handled properly diff --git a/mysql-test/t/mysql_delimiter.sql b/mysql-test/t/mysql_delimiter.sql index 917401275a2..533ac2ce093 100644 --- a/mysql-test/t/mysql_delimiter.sql +++ b/mysql-test/t/mysql_delimiter.sql @@ -61,12 +61,6 @@ show tables// delimiter ; # Reset delimiter # -# Bug #33812: mysql client incorrectly parsing DELIMITER -# -select a as delimiter from t1 -delimiter ; # Reset delimiter - -# # Bug #36244: MySQL CLI doesn't recognize standalone -- as comment # before DELIMITER statement # diff --git a/mysys/default.c b/mysys/default.c index 7803b81c31d..2b06058a00b 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -1026,7 +1026,7 @@ static const char *my_get_module_parent(char *buf, size_t size) { char *last= NULL; char *end; - if (!GetModuleFileName(NULL, buf, size)) + if (!GetModuleFileName(NULL, buf, (DWORD) size)) return NULL; end= strend(buf); |