Commit dc5d1c87 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-4.1/

into serg.mylan:/usr/home/serg/Abk/mysql-4.1

parents 189a91df 7b93f385
......@@ -288,6 +288,24 @@ latin2_general_ci 3
select collation(trim(BOTH _latin2' ' FROM _latin2'a')), coercibility(trim(BOTH _latin2'a' FROM _latin2'a'));
collation(trim(BOTH _latin2' ' FROM _latin2'a')) coercibility(trim(BOTH _latin2'a' FROM _latin2'a'))
latin2_general_ci 3
select collation(repeat(_latin2'a',10)), coercibility(repeat(_latin2'a',10));
collation(repeat(_latin2'a',10)) coercibility(repeat(_latin2'a',10))
latin2_general_ci 3
select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab'));
collation(reverse(_latin2'ab')) coercibility(reverse(_latin2'ab'))
latin2_general_ci 3
select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab'));
collation(quote(_latin2'ab')) coercibility(quote(_latin2'ab'))
latin2_general_ci 3
select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
collation(soundex(_latin2'ab')) coercibility(soundex(_latin2'ab'))
latin2_general_ci 3
select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
collation(substring(_latin2'ab',1)) coercibility(substring(_latin2'ab',1))
latin2_general_ci 3
select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
collation(insert(_latin2'abcd',2,3,_latin2'ef')) coercibility(insert(_latin2'abcd',2,3,_latin2'ef'))
latin2_general_ci 3
create table t1
select
left(_latin2'a',1),
......@@ -302,7 +320,13 @@ ltrim(_latin2' a '),
rtrim(_latin2' a '),
trim(LEADING _latin2' ' FROM _latin2' a '),
trim(TRAILING _latin2' ' FROM _latin2' a '),
trim(BOTH _latin2' ' FROM _latin2' a ')
trim(BOTH _latin2' ' FROM _latin2' a '),
repeat(_latin2'a',10),
reverse(_latin2'ab'),
quote(_latin2'ab'),
soundex(_latin2'ab'),
substring(_latin2'ab',1),
insert(_latin2'abcd',2,3,_latin2'ef')
;
show create table t1;
Table Create Table
......@@ -319,6 +343,12 @@ t1 CREATE TABLE `t1` (
`rtrim(_latin2' a ')` char(3) character set latin2 NOT NULL default '',
`trim(LEADING _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
`trim(TRAILING _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
`trim(BOTH _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default ''
`trim(BOTH _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
`repeat(_latin2'a',10)` char(10) character set latin2 NOT NULL default '',
`reverse(_latin2'ab')` char(2) character set latin2 NOT NULL default '',
`quote(_latin2'ab')` char(6) character set latin2 NOT NULL default '',
`soundex(_latin2'ab')` char(4) character set latin2 NOT NULL default '',
`substring(_latin2'ab',1)` char(2) character set latin2 NOT NULL default '',
`insert(_latin2'abcd',2,3,_latin2'ef')` char(6) character set latin2 NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1
drop table t1;
......@@ -52,6 +52,63 @@ select 10 % 7, 10 mod 7, 10 div 3;
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
18446744073709551615 18446744073709551615 9223372036854775807
select _koi8r'a' = _koi8r'A';
_koi8r'a' = _koi8r'A'
1
select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci
1
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
0
select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A';
_koi8r'a' COLLATE koi8r_general_ci = _koi8r'A'
1
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A';
_koi8r'a' COLLATE koi8r_bin = _koi8r'A'
0
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci;
ERROR HY000: Illegal mix of collations (koi8r_bin,EXPLICIT) and (koi8r_general_ci,EXPLICIT) for operation '='
select _koi8r'a' = _latin1'A';
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation '='
select strcmp(_koi8r'a', _koi8r'A');
strcmp(_koi8r'a', _koi8r'A')
0
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci);
strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci)
0
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin);
strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin)
1
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A');
strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A')
0
select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A');
strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A')
1
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin);
ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'strcmp'
select strcmp(_koi8r'a', _latin1'A');
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'strcmp'
select _koi8r'a' LIKE _koi8r'A';
_koi8r'a' LIKE _koi8r'A'
1
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci;
_koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci
1
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin;
_koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin
0
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A';
_koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A'
1
select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
_koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A'
0
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'like'
select _koi8r'a' LIKE _latin1'A';
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'like'
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
......
......@@ -149,6 +149,13 @@ select collation(rtrim(_latin2' a ')), coercibility(rtrim(_latin2' a '));
select collation(trim(LEADING _latin2' ' FROM _latin2'a')), coercibility(trim(LEADING _latin2'a' FROM _latin2'a'));
select collation(trim(TRAILING _latin2' ' FROM _latin2'a')), coercibility(trim(TRAILING _latin2'a' FROM _latin2'a'));
select collation(trim(BOTH _latin2' ' FROM _latin2'a')), coercibility(trim(BOTH _latin2'a' FROM _latin2'a'));
select collation(repeat(_latin2'a',10)), coercibility(repeat(_latin2'a',10));
select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab'));
select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab'));
select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
create table t1
select
left(_latin2'a',1),
......@@ -163,7 +170,13 @@ select
rtrim(_latin2' a '),
trim(LEADING _latin2' ' FROM _latin2' a '),
trim(TRAILING _latin2' ' FROM _latin2' a '),
trim(BOTH _latin2' ' FROM _latin2' a ')
trim(BOTH _latin2' ' FROM _latin2' a '),
repeat(_latin2'a',10),
reverse(_latin2'ab'),
quote(_latin2'ab'),
soundex(_latin2'ab'),
substring(_latin2'ab',1),
insert(_latin2'abcd',2,3,_latin2'ef')
;
show create table t1;
......
......@@ -20,6 +20,41 @@ select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
select 10 % 7, 10 mod 7, 10 div 3;
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
#
# Coercibility
#
select _koi8r'a' = _koi8r'A';
select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A';
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A';
--error 1265
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci;
--error 1265
select _koi8r'a' = _latin1'A';
select strcmp(_koi8r'a', _koi8r'A');
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci);
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin);
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A');
select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A');
--error 1265
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin);
--error 1265
select strcmp(_koi8r'a', _latin1'A');
select _koi8r'a' LIKE _koi8r'A';
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci;
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin;
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A';
select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
--error 1265
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
--error 1265
select _koi8r'a' LIKE _latin1'A';
#
# Wrong usage of functions
#
......
......@@ -263,13 +263,6 @@ class Item_func_strcmp :public Item_bool_func2
public:
Item_func_strcmp(Item *a,Item *b) :Item_bool_func2(a,b) {}
longlong val_int();
void fix_length_and_dec()
{
max_length=2;
/* QQ: COERCIBILITY */
cmp_charset= args[0]->binary() || args[1]->binary() ?
&my_charset_bin : args[0]->charset();
}
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "strcmp"; }
};
......
......@@ -702,6 +702,7 @@ String *Item_func_reverse::val_str(String *str)
void Item_func_reverse::fix_length_and_dec()
{
set_charset(args[0]->charset(),args[0]->coercibility);
max_length = args[0]->max_length;
}
......@@ -860,6 +861,14 @@ null:
void Item_func_insert::fix_length_and_dec()
{
if (set_charset(args[0]->charset(), args[0]->coercibility,
args[3]->charset(), args[3]->coercibility))
{
my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
args[0]->charset()->name,coercion_name(args[0]->coercibility),
args[3]->charset()->name,coercion_name(args[3]->coercibility),
func_name());
}
max_length=args[0]->max_length+args[3]->max_length;
if (max_length > MAX_BLOB_WIDTH)
{
......@@ -1521,6 +1530,7 @@ String *Item_func_user::val_str(String *str)
void Item_func_soundex::fix_length_and_dec()
{
set_charset(args[0]->charset(), args[0]->coercibility);
max_length=args[0]->max_length;
set_if_bigger(max_length,4);
}
......@@ -1552,7 +1562,7 @@ String *Item_func_soundex::val_str(String *str)
{
String *res =args[0]->val_str(str);
char last_ch,ch;
CHARSET_INFO *cs= &my_charset_latin1;
CHARSET_INFO *cs= charset();
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
......@@ -2538,6 +2548,7 @@ String *Item_func_quote::val_str(String *str)
}
*to= '\'';
str->length(new_length);
str->set_charset(charset());
return str;
null:
......
......@@ -571,7 +571,11 @@ public:
Item_func_quote(Item *a) :Item_str_func(a) {}
const char *func_name() const { return "quote"; }
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length * 2 + 2; }
void fix_length_and_dec()
{
set_charset(args[0]->charset(), args[0]->coercibility);
max_length= args[0]->max_length * 2 + 2;
}
};
class Item_func_conv_charset :public Item_str_func
......
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