diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2004-07-07 17:26:43 +0500 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2004-07-07 17:26:43 +0500 |
commit | a772701340d8c837550f30d06b78a87e2931d61d (patch) | |
tree | a9cdeb8223ba329b50d432f14b4c8a73443aeb58 /mysql-test/t/sql_mode.test | |
parent | fa5f9d64afb939b0dae2f4e29006fa39326860c2 (diff) | |
download | mariadb-git-a772701340d8c837550f30d06b78a87e2931d61d.tar.gz |
patch for task WL 1941 "NO_C_ESCAPE sql_mode"
mysql-test/r/sql_mode.result:
added test for WL 1941 "NO_C_ESCAPE sql_mode"
mysql-test/t/sql_mode.test:
added test for WL 1941 "NO_C_ESCAPE sql_mode"
sql/mysql_priv.h:
added MODE_NO_BACKSLASH_ESCAPES
sql/mysqld.cc:
added mode NO_BACKSLASH_ESCAPES
sql/sql_lex.cc:
added test for MODE_NO_BACKSLASH_ESCAPES when testing escaped character
sql/sql_yacc.yy:
added using of "" as escape by default
in LIKE function if MODE_NO_BACKSLASH_ESCAPES
Diffstat (limited to 'mysql-test/t/sql_mode.test')
-rw-r--r-- | mysql-test/t/sql_mode.test | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test index 95e83b4b9e2..c7b6510db9d 100644 --- a/mysql-test/t/sql_mode.test +++ b/mysql-test/t/sql_mode.test @@ -28,3 +28,98 @@ set sql_mode="postgresql,oracle,mssql,db2,maxdb"; select @@sql_mode; show create table t1; drop table t1; + +# +# test for +# WL 1941 "NO_C_ESCAPES sql_mode" +# +# an sql_mode to disable \n, \r, \b, etc escapes in string literals. actually, to +# disable special meaning of backslash completely. It's not in the SQL standard +# and it causes some R/3 tests to fail. +# + +SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=''; +show local variables like 'SQL_MODE'; + +CREATE TABLE t1 (p int not null auto_increment, a varchar(20), primary key(p)); +INSERT t1 (a) VALUES +('\\'), +('\n'), +('\b'), +('\r'), +('\t'), +('\x'), +('\a'), +('\aa'), +('\\a'), +('\\aa'), +('_'), +('\_'), +('\\_'), +('\\\_'), +('\\\\_'), +('%'), +('\%'), +('\\%'), +('\\\%'), +('\\\\%') +; + +SELECT p, hex(a) FROM t1; + +delete from t1 where a in ('\n','\r','\t', '\b'); + +select + masks.p, + masks.a as mask, + examples.a as example +from + t1 as masks + left join t1 as examples on examples.a LIKE masks.a +order by masks.p, example; + +DROP TABLE t1; + +SET @@SQL_MODE='NO_BACKSLASH_ESCAPES'; +show local variables like 'SQL_MODE'; + +CREATE TABLE t1 (p int not null auto_increment, a varchar(20), primary key(p)); +INSERT t1 (a) VALUES +('\\'), +('\n'), +('\b'), +('\r'), +('\t'), +('\x'), +('\a'), +('\aa'), +('\\a'), +('\\aa'), +('_'), +('\_'), +('\\_'), +('\\\_'), +('\\\\_'), +('%'), +('\%'), +('\\%'), +('\\\%'), +('\\\\%') +; + +SELECT p, hex(a) FROM t1; + +delete from t1 where a in ('\n','\r','\t', '\b'); + +select + masks.p, + masks.a as mask, + examples.a as example +from + t1 as masks + left join t1 as examples on examples.a LIKE masks.a +order by masks.p, example; + +DROP TABLE t1; + +SET @@SQL_MODE=@OLD_SQL_MODE; |