mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
Fix for bug#3946: Error in LPAD() when padstring is longer than 1 character
mysql-test/r/ctype_ucs.result: Test for bug#3946: Error in LPAD() when padstring is longer than 1 character mysql-test/t/ctype_ucs.test: Test for bug#3946: Error in LPAD() when padstring is longer than 1 character
This commit is contained in:
parent
5cc410bb70
commit
fd94477b43
3 changed files with 21 additions and 4 deletions
|
@ -47,6 +47,15 @@ t1 CREATE TABLE `t1` (
|
||||||
`r` char(10) character set ucs2 NOT NULL default ''
|
`r` char(10) character set ucs2 NOT NULL default ''
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
create table t2(f1 Char(30));
|
||||||
|
insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
|
||||||
|
select lpad(f1, 12, "-o-/") from t2;
|
||||||
|
lpad(f1, 12, "-o-/")
|
||||||
|
-o-/-o103000
|
||||||
|
-o-/22720000
|
||||||
|
-o-/-3401200
|
||||||
|
-o-/-o-78000
|
||||||
|
drop table t2;
|
||||||
SET NAMES koi8r;
|
SET NAMES koi8r;
|
||||||
SET character_set_connection=ucs2;
|
SET character_set_connection=ucs2;
|
||||||
create table t1 (a varchar(10) character set ucs2, key(a));
|
create table t1 (a varchar(10) character set ucs2, key(a));
|
||||||
|
|
|
@ -47,6 +47,16 @@ LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
|
||||||
RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
|
RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG3946
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t2(f1 Char(30));
|
||||||
|
insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
|
||||||
|
select lpad(f1, 12, "-o-/") from t2;
|
||||||
|
drop table t2;
|
||||||
######################################################
|
######################################################
|
||||||
#
|
#
|
||||||
# Test of like
|
# Test of like
|
||||||
|
|
|
@ -2097,10 +2097,8 @@ String *Item_func_lpad::val_str(String *str)
|
||||||
count-= pad_char_length;
|
count-= pad_char_length;
|
||||||
}
|
}
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
str->append(pad->ptr(), pad->charpos(count), collation.collation);
|
||||||
pad->length(pad->charpos(count));
|
|
||||||
str->append(*pad);
|
|
||||||
}
|
|
||||||
str->append(*res);
|
str->append(*res);
|
||||||
null_value= 0;
|
null_value= 0;
|
||||||
return str;
|
return str;
|
||||||
|
|
Loading…
Reference in a new issue