From 80d2d8d662d9e3db96295d831358a5d633a3c2eb Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Fri, 8 Oct 2004 15:16:03 +0400 Subject: [PATCH] Fix for bug #5887 "Triggers with string literals cause errors" Fixed small error in new .FRM parser which caused it to handle improperly escaped strings. --- mysql-test/r/trigger.result | 5 +++++ mysql-test/t/trigger.test | 14 ++++++++++++++ sql/parse_file.cc | 1 + 3 files changed, 20 insertions(+) diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index a7a845fa3e0..2a2e10dbbd5 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -169,3 +169,8 @@ create temporary table t1 (i int); create trigger trg before insert on t1 for each row set @a:=1; ERROR HY000: Trigger's 't1' is view or temporary table drop table t1; +create table t1 (x1col char); +create trigger tx1 before insert on t1 for each row set new.x1col = 'x'; +insert into t1 values ('y'); +drop trigger t1.tx1; +drop table t1; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 8922f73661e..f842d561dc1 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -193,3 +193,17 @@ create temporary table t1 (i int); --error 1361 create trigger trg before insert on t1 for each row set @a:=1; drop table t1; + + + +# +# Tests for various trigger-related bugs +# + +# Test for bug #5887 "Triggers with string literals cause errors". +# New .FRM parser was not handling escaped strings properly. +create table t1 (x1col char); +create trigger tx1 before insert on t1 for each row set new.x1col = 'x'; +insert into t1 values ('y'); +drop trigger t1.tx1; +drop table t1; diff --git a/sql/parse_file.cc b/sql/parse_file.cc index 16674793b48..f548c16d808 100644 --- a/sql/parse_file.cc +++ b/sql/parse_file.cc @@ -502,6 +502,7 @@ read_escaped_string(char *ptr, char *eol, LEX_STRING *str) break; case '\'': *write_pos= '\''; + break; default: return TRUE; }