Commit 50cc21ea authored by unknown's avatar unknown
Browse files

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

 - Move clearing of expected errors


client/mysqltest.c:
  Move clear of expected errors to the query loop so that the expected error is reset even when the query is retrieved from the q_lines cache.
mysql-test/r/mysqltest.result:
  Update test results
mysql-test/t/mysqltest.test:
  Add test for bug#12471
parent 43422ece
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -2385,8 +2385,6 @@ int read_query(struct st_query** q_ptr)
	 sizeof(global_expected_errno));
  q->expected_errors= global_expected_errors;
  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] == '-')
  {
    q->type= Q_COMMENT_WITH_COMMAND;
@@ -4002,6 +4000,16 @@ int main(int argc, char **argv)
    else
      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;
  }

+7 −0
Original line number Diff line number Diff line
@@ -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: End of line junk detected: "!"
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
+13 −0
Original line number Diff line number Diff line
@@ -775,4 +775,17 @@ select "a" as col1, "c" as col2;
# new scripts and diagnose errors
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Test bug#12386
# ----------------------------------------------------------------------------
let $num= 2;
while ($num)
{
   --error 1064
   failing_statement;

   dec $num;
}

SELECT 1 as a;