Commit 895db718 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

Merge abarkov@build.mysql.com:/home/bk/mysql-4.1

into bar.mysql.r18.ru:/usr/home/bar/mysql-4.1
parents 76feb411 8514caa1
...@@ -249,3 +249,45 @@ INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf'); ...@@ -249,3 +249,45 @@ INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password"); SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
1 1
DROP TABLE t1; DROP TABLE t1;
select collation(lcase(_latin2'a')), coercibility(lcase(_latin2'a'));
collation(lcase(_latin2'a')) coercibility(lcase(_latin2'a'))
latin2_general_ci 3
select collation(ucase(_latin2'a')), coercibility(ucase(_latin2'a'));
collation(ucase(_latin2'a')) coercibility(ucase(_latin2'a'))
latin2_general_ci 3
select collation(left(_latin2'a',1)), coercibility(left(_latin2'a',1));
collation(left(_latin2'a',1)) coercibility(left(_latin2'a',1))
latin2_general_ci 3
select collation(right(_latin2'a',1)), coercibility(right(_latin2'a',1));
collation(right(_latin2'a',1)) coercibility(right(_latin2'a',1))
latin2_general_ci 3
select collation(substring(_latin2'a',1,1)), coercibility(substring(_latin2'a',1,1));
collation(substring(_latin2'a',1,1)) coercibility(substring(_latin2'a',1,1))
latin2_general_ci 3
select collation(concat(_latin2'a',_latin2'b')), coercibility(concat(_latin2'a',_latin2'b'));
collation(concat(_latin2'a',_latin2'b')) coercibility(concat(_latin2'a',_latin2'b'))
latin2_general_ci 3
select collation(concat_ws(_latin2'a',_latin2'b')), coercibility(concat_ws(_latin2'a',_latin2'b'));
collation(concat_ws(_latin2'a',_latin2'b')) coercibility(concat_ws(_latin2'a',_latin2'b'))
latin2_general_ci 3
create table t1
select
left(_latin2'a',1),
right(_latin2'a',1),
lcase(_latin2'a'),
ucase(_latin2'a'),
substring(_latin2'a',1,1),
concat(_latin2'a',_latin2'b'),
concat_ws(_latin2'a',_latin2'b');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`left(_latin2'a',1)` char(1) character set latin2 NOT NULL default '',
`right(_latin2'a',1)` char(1) character set latin2 NOT NULL default '',
`lcase(_latin2'a')` char(1) character set latin2 NOT NULL default '',
`ucase(_latin2'a')` char(1) character set latin2 NOT NULL default '',
`substring(_latin2'a',1,1)` char(1) character set latin2 NOT NULL default '',
`concat(_latin2'a',_latin2'b')` char(2) character set latin2 NOT NULL default '',
`concat_ws(_latin2'a',_latin2'b')` char(1) character set latin2 NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1
drop table t1;
...@@ -132,3 +132,26 @@ CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id ( ...@@ -132,3 +132,26 @@ CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (
INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf'); INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password"); SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
DROP TABLE t1; DROP TABLE t1;
#
# Test collation and coercibility
#
select collation(lcase(_latin2'a')), coercibility(lcase(_latin2'a'));
select collation(ucase(_latin2'a')), coercibility(ucase(_latin2'a'));
select collation(left(_latin2'a',1)), coercibility(left(_latin2'a',1));
select collation(right(_latin2'a',1)), coercibility(right(_latin2'a',1));
select collation(substring(_latin2'a',1,1)), coercibility(substring(_latin2'a',1,1));
select collation(concat(_latin2'a',_latin2'b')), coercibility(concat(_latin2'a',_latin2'b'));
select collation(concat_ws(_latin2'a',_latin2'b')), coercibility(concat_ws(_latin2'a',_latin2'b'));
create table t1
select
left(_latin2'a',1),
right(_latin2'a',1),
lcase(_latin2'a'),
ucase(_latin2'a'),
substring(_latin2'a',1,1),
concat(_latin2'a',_latin2'b'),
concat_ws(_latin2'a',_latin2'b');
show create table t1;
drop table t1;
...@@ -928,7 +928,7 @@ void Item_str_func::left_right_max_length() ...@@ -928,7 +928,7 @@ void Item_str_func::left_right_max_length()
max_length=args[0]->max_length; max_length=args[0]->max_length;
if (args[1]->const_item()) if (args[1]->const_item())
{ {
int length=(int) args[1]->val_int()*default_charset_info->mbmaxlen; int length=(int) args[1]->val_int()*charset()->mbmaxlen;
if (length <= 0) if (length <= 0)
max_length=0; max_length=0;
else else
...@@ -939,6 +939,7 @@ void Item_str_func::left_right_max_length() ...@@ -939,6 +939,7 @@ void Item_str_func::left_right_max_length()
void Item_func_left::fix_length_and_dec() void Item_func_left::fix_length_and_dec()
{ {
set_charset(args[0]->charset(), args[0]->coercibility);
left_right_max_length(); left_right_max_length();
} }
...@@ -965,6 +966,7 @@ String *Item_func_right::val_str(String *str) ...@@ -965,6 +966,7 @@ String *Item_func_right::val_str(String *str)
void Item_func_right::fix_length_and_dec() void Item_func_right::fix_length_and_dec()
{ {
set_charset(args[0]->charset(), args[0]->coercibility);
left_right_max_length(); left_right_max_length();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment