Loading client/mysql.cc +37 −17 Original line number Diff line number Diff line Loading @@ -1245,6 +1245,7 @@ static bool add_line(String &buffer,char *line,char *in_string, char buff[80], *pos, *out; COMMANDS *com; bool need_space= 0; bool ss_comment= 0; DBUG_ENTER("add_line"); if (!line[0] && buffer.is_empty()) Loading Loading @@ -1298,6 +1299,19 @@ static bool add_line(String &buffer,char *line,char *in_string, if ((*com->func)(&buffer,pos-1) > 0) DBUG_RETURN(1); // Quit if (com->takes_params) { if (ss_comment) { /* If a client-side macro appears inside a server-side comment, discard all characters in the comment after the macro (that is, until the end of the comment rather than the next delimiter) */ for (pos++; *pos && (*pos != '*' || *(pos + 1) != '/'); pos++) ; pos--; } else { for (pos++ ; *pos && (*pos != *delimiter || Loading @@ -1308,6 +1322,7 @@ static bool add_line(String &buffer,char *line,char *in_string, else pos+= delimiter_length - 1; // Point at last delim char } } out=line; } else Loading Loading @@ -1368,7 +1383,7 @@ static bool add_line(String &buffer,char *line,char *in_string, out=line; } } else if (*ml_comment && inchar == '*' && *(pos + 1) == '/') else if (*ml_comment && !ss_comment && inchar == '*' && *(pos + 1) == '/') { pos++; *ml_comment= 0; Loading @@ -1376,6 +1391,11 @@ static bool add_line(String &buffer,char *line,char *in_string, } else { // Add found char to buffer if (!*in_string && inchar == '/' && *(pos + 1) == '*' && *(pos + 2) == '!') ss_comment= 1; else if (!*in_string && ss_comment && inchar == '*' && *(pos + 1) == '/') ss_comment= 0; if (inchar == *in_string) *in_string= 0; else if (!*ml_comment && !*in_string && Loading mysql-test/r/mysql.result +2 −0 Original line number Diff line number Diff line Loading @@ -176,4 +176,6 @@ ERROR at line 1: DELIMITER cannot contain a backslash character ERROR at line 1: DELIMITER cannot contain a backslash character 1 1 1 1 End of 5.0 tests mysql-test/t/mysql.test +5 −0 Original line number Diff line number Diff line Loading @@ -273,4 +273,9 @@ EOF --exec $MYSQL --pager="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxx" -e "select 1" 2>&1 # # bug #30164: Using client side macro inside server side comments generates broken queries # --exec $MYSQL test -e "/*! \C latin1 */ select 1;" --echo End of 5.0 tests Loading
client/mysql.cc +37 −17 Original line number Diff line number Diff line Loading @@ -1245,6 +1245,7 @@ static bool add_line(String &buffer,char *line,char *in_string, char buff[80], *pos, *out; COMMANDS *com; bool need_space= 0; bool ss_comment= 0; DBUG_ENTER("add_line"); if (!line[0] && buffer.is_empty()) Loading Loading @@ -1298,6 +1299,19 @@ static bool add_line(String &buffer,char *line,char *in_string, if ((*com->func)(&buffer,pos-1) > 0) DBUG_RETURN(1); // Quit if (com->takes_params) { if (ss_comment) { /* If a client-side macro appears inside a server-side comment, discard all characters in the comment after the macro (that is, until the end of the comment rather than the next delimiter) */ for (pos++; *pos && (*pos != '*' || *(pos + 1) != '/'); pos++) ; pos--; } else { for (pos++ ; *pos && (*pos != *delimiter || Loading @@ -1308,6 +1322,7 @@ static bool add_line(String &buffer,char *line,char *in_string, else pos+= delimiter_length - 1; // Point at last delim char } } out=line; } else Loading Loading @@ -1368,7 +1383,7 @@ static bool add_line(String &buffer,char *line,char *in_string, out=line; } } else if (*ml_comment && inchar == '*' && *(pos + 1) == '/') else if (*ml_comment && !ss_comment && inchar == '*' && *(pos + 1) == '/') { pos++; *ml_comment= 0; Loading @@ -1376,6 +1391,11 @@ static bool add_line(String &buffer,char *line,char *in_string, } else { // Add found char to buffer if (!*in_string && inchar == '/' && *(pos + 1) == '*' && *(pos + 2) == '!') ss_comment= 1; else if (!*in_string && ss_comment && inchar == '*' && *(pos + 1) == '/') ss_comment= 0; if (inchar == *in_string) *in_string= 0; else if (!*ml_comment && !*in_string && Loading
mysql-test/r/mysql.result +2 −0 Original line number Diff line number Diff line Loading @@ -176,4 +176,6 @@ ERROR at line 1: DELIMITER cannot contain a backslash character ERROR at line 1: DELIMITER cannot contain a backslash character 1 1 1 1 End of 5.0 tests
mysql-test/t/mysql.test +5 −0 Original line number Diff line number Diff line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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" 2>&1 # # bug #30164: Using client side macro inside server side comments generates broken queries # --exec $MYSQL test -e "/*! \C latin1 */ select 1;" --echo End of 5.0 tests