diff options
author | unknown <monty@tik.mysql.com> | 2000-12-15 10:58:17 +0200 |
---|---|---|
committer | unknown <monty@tik.mysql.com> | 2000-12-15 10:58:17 +0200 |
commit | e1e7ba756a609f9e78d4cbf8291b7f1859df4425 (patch) | |
tree | af18dadc582d3cff29172087140d13e2a78fecac /mysql-test | |
parent | 6d8a5e9088526f2fb86bf7aaefc7426ee1291afc (diff) | |
download | mariadb-git-e1e7ba756a609f9e78d4cbf8291b7f1859df4425.tar.gz |
Fixed that LPAD() and RPAD() cuts arguments
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
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/strfunc.result | 62 | ||||
-rw-r--r-- | mysql-test/t/strfunc.test | 40 |
2 files changed, 102 insertions, 0 deletions
diff --git a/mysql-test/r/strfunc.result b/mysql-test/r/strfunc.result new file mode 100644 index 00000000000..ac352d2ffb7 --- /dev/null +++ b/mysql-test/r/strfunc.result @@ -0,0 +1,62 @@ +hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo +hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo +hello +hellomonty +length('\n\t\r\b\0\_\%\\') +10 +concat('monty',' was here ','again') length('hello') char(ascii('h')) +monty was here again 5 h +locate('he','hello') locate('he','hello',2) locate('lo','hello',2) +1 0 4 +instr('hello','he') +1 +position('ll' in 'hello') position('a' in 'hello') +3 0 +left('hello',2) right('hello',2) substring('hello',2,2) mid('hello',1,5) +he lo el hello +concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) +happy +substring_index('www.tcx.se','.',-2) substring_index('www.tcx.se','.',1) +tcx.se www +substring_index('www.tcx.se','tcx',1) substring_index('www.tcx.se','tcx',-1) +www. .se +substring_index('.tcx.se','.',-2) substring_index('.tcx.se','.tcx',-1) +tcx.se .se +concat(':',ltrim(' left '),':',rtrim(' right '),':') +:left : right: +concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':') +:left: right: +concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':') +:m:y:s: +concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':') +:my:sql: +concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':') +:my:sql: +insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es') +this is a test +replace('aaaa','a','b') replace('aaaa','aa','b') replace('aaaa','a','bb') replace('aaaa','','b') replace('bbbb','a','c') +bbbb bb bbbbbbbb aaaa bbbb +replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') +this is a REAL test +soundex('') soundex('he') soundex('hello all folks') + H000 H4142 +password('test') length(encrypt('test')) encrypt('test','aa') +378b243e220ca493 13 aaqPiZY5xR5l. +md5('hello') +5d41402abc4b2a76b9719d911017c592 +repeat('monty',5) concat('*',space(5),'*') +montymontymontymontymonty * * +reverse('abc') reverse('abcd') +cba dcba +rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12') +a111 a121 abc +lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12') +111a 121a abc +rpad(741653838,17,'0') lpad(741653838,17,'0') +74165383800000000 00000000741653838 +rpad('abcd',7,'ab') lpad('abcd',7,'ab') +abcdaba abaabcd +rpad('abcd',1,'ab') lpad('abcd',1,'ab') +a a +LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') +HAROLD HARRY diff --git a/mysql-test/t/strfunc.test b/mysql-test/t/strfunc.test new file mode 100644 index 00000000000..7b49da05614 --- /dev/null +++ b/mysql-test/t/strfunc.test @@ -0,0 +1,40 @@ +# 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'); |