From 549c5ea15a3b67f75e80c6c3c87cc610230feca3 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Jan 2005 23:31:37 +0200 Subject: Streamlined code for trim, ltrim and rtrim Portability fixes mysql-test/r/func_str.result: Added test for ltrim and rtrim with NULL mysql-test/t/func_str.test: Added test for ltrim and rtrim with NULL sql/item_strfunc.cc: Streamlined code for trim, ltrim and rtrim tests/client_test.c: Fixed wrong usage of %lld (not portable) --- mysql-test/r/func_str.result | 9 +++++++++ mysql-test/t/func_str.test | 3 +++ 2 files changed, 12 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 530651e63f8..2399099b478 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -48,6 +48,9 @@ tcx.se .se select concat(':',ltrim(' left '),':',rtrim(' right '),':'); concat(':',ltrim(' left '),':',rtrim(' right '),':') :left : right: +select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':'); +concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':') +:left : right: select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':'); concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':') :left: right: @@ -703,3 +706,9 @@ NULL select trim('xyz' from null) as "must_be_null"; must_be_null NULL +select trim(leading NULL from 'kate') as "must_be_null"; +must_be_null +NULL +select trim(trailing NULL from 'xyz') as "must_be_null"; +must_be_null +NULL diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index a5d95332caa..4a1b8470ada 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -25,6 +25,7 @@ select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx', select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1); select concat(':',ltrim(' left '),':',rtrim(' right '),':'); +select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':'); select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':'); select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':'); select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':'); @@ -443,3 +444,5 @@ select quote(trim(concat(' ', 'a'))); # select trim(null from 'kate') as "must_be_null"; select trim('xyz' from null) as "must_be_null"; +select trim(leading NULL from 'kate') as "must_be_null"; +select trim(trailing NULL from 'xyz') as "must_be_null"; -- cgit v1.2.1 From b76b2ba6667f847624e5d9475a3a0190105e5218 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Jan 2005 13:56:23 +0200 Subject: Remove clear_insert_values() because it was far from trivial to handle the cleanup in all cases (Old code failed for INSERT ... ON DUPLICATE with prepared statements) Instead, always reset table->insert_values on open. mysql-test/t/trigger.test: Fix test for --ps-protocol sql/sql_base.cc: Clear insert_values on open_table sql/sql_insert.cc: Remove clear_insert_values() sql/sql_parse.cc: Remove clear_insert_values() sql/sql_prepare.cc: Remove clear_insert_values() sql/table.cc: Remove clear_insert_values() sql/table.h: Remove clear_insert_values() --- mysql-test/t/trigger.test | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index d4879b22bae..3900e59c2ee 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -53,6 +53,7 @@ select @a; drop trigger t1.trg; drop table t1; +--disable_ps_protocol # Before update trigger # (In future we will achieve this via proper error handling in triggers) create table t1 (aid int not null primary key, balance int not null default 0); @@ -74,6 +75,7 @@ select * from t1| drop trigger t1.trg| drop table t1| delimiter ;| +--enable_ps_protocol # After update trigger create table t1 (i int); -- cgit v1.2.1