Bug #12471 mysqltest, --error within loop affects wrong statement

 - Move clearing of expected errors
parent d692f0c0
...@@ -2385,8 +2385,6 @@ int read_query(struct st_query** q_ptr) ...@@ -2385,8 +2385,6 @@ int read_query(struct st_query** q_ptr)
sizeof(global_expected_errno)); sizeof(global_expected_errno));
q->expected_errors= global_expected_errors; q->expected_errors= global_expected_errors;
q->abort_on_error= (global_expected_errors == 0 && abort_on_error); q->abort_on_error= (global_expected_errors == 0 && abort_on_error);
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
global_expected_errors=0;
if (p[0] == '-' && p[1] == '-') if (p[0] == '-' && p[1] == '-')
{ {
q->type= Q_COMMENT_WITH_COMMAND; q->type= Q_COMMENT_WITH_COMMAND;
...@@ -4002,6 +4000,16 @@ int main(int argc, char **argv) ...@@ -4002,6 +4000,16 @@ int main(int argc, char **argv)
else else
check_eol_junk(q->last_argument); check_eol_junk(q->last_argument);
if (q->type != Q_ERROR)
{
/*
As soon as any non "error" command has been executed,
the array with expected errors should be cleared
*/
global_expected_errors= 0;
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
}
parser.current_line += current_line_inc; parser.current_line += current_line_inc;
} }
......
...@@ -341,3 +341,10 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 ...@@ -341,3 +341,10 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!" mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Invalid integer argument "a"
failing_statement;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
failing_statement;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
SELECT 1 as a;
a
1
...@@ -775,4 +775,17 @@ select "a" as col1, "c" as col2; ...@@ -775,4 +775,17 @@ select "a" as col1, "c" as col2;
# new scripts and diagnose errors # new scripts and diagnose errors
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Test bug#12386
# ----------------------------------------------------------------------------
let $num= 2;
while ($num)
{
--error 1064
failing_statement;
dec $num;
}
SELECT 1 as a;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment