summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2005-09-01 09:34:40 +0200
committerunknown <msvensson@neptunus.(none)>2005-09-01 09:34:40 +0200
commit50cc21ea3e5f4ebcd3f9185c5f64746d5b0b7a98 (patch)
treef9a739c4ec38db5352892840450f16eca04a23ca
parent43422eceb516932603110a7b8665496d4132de35 (diff)
downloadmariadb-git-50cc21ea3e5f4ebcd3f9185c5f64746d5b0b7a98.tar.gz
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
-rw-r--r--client/mysqltest.c12
-rw-r--r--mysql-test/r/mysqltest.result7
-rw-r--r--mysql-test/t/mysqltest.test13
3 files changed, 30 insertions, 2 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index bd467e821ab..3b13084081e 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -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;
}
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 668cf6beb57..36dc09b9e24 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -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
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index a2c2dc1fa16..c1ebbb7fb3b 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -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;