mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
e1e7ba756a
New test for string functions Docs/manual.texi: Updated changes for 3.23.29 client/mysqldump.c: Cleanup libmysql/libmysql.c: Fixed possible overflow sql/handler.cc: Fixed typo sql/item_strfunc.cc: Fixed that LPAD() and RPAD() cuts arguments sql/mysqld.cc: Better error message on core dump BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
40 lines
2.2 KiB
Text
40 lines
2.2 KiB
Text
# Version: 3.23.29
|
|
#
|
|
# Description
|
|
# -----------
|
|
# Testing string functions
|
|
|
|
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
|
|
select 'hello' 'monty';
|
|
select length('\n\t\r\b\0\_\%\\');
|
|
select concat('monty',' was here ','again'),length('hello'),char(ascii('h'));
|
|
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
|
|
select instr('hello','he');
|
|
select position('ll' in 'hello'),position('a' in 'hello');
|
|
select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
|
|
select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ;
|
|
select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1);
|
|
select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',-1);
|
|
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(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':');
|
|
select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':');
|
|
select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':');
|
|
|
|
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
|
|
select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c');
|
|
select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
|
|
select soundex(''),soundex('he'),soundex('hello all folks');
|
|
select password('test'),length(encrypt('test')),encrypt('test','aa');
|
|
select md5('hello');
|
|
select repeat('monty',5),concat('*',space(5),'*');
|
|
select reverse('abc'),reverse('abcd');
|
|
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12');
|
|
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12');
|
|
select rpad(741653838,17,'0'),lpad(741653838,17,'0');
|
|
select rpad('abcd',7,'ab'),lpad('abcd',7,'ab');
|
|
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
|
|
|
|
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
|