Commit 2aa10d24 authored by unknown's avatar unknown

Merge abarkov@bk-internal:/home/bk/mysql-5.0

into  mysql.com:/usr/home/bar/mysql-5.0.char1

parents 4083d456 dddb6812
......@@ -1064,46 +1064,56 @@ xxx
yyy
DROP TABLE t1;
set names utf8;
select hex(char(1));
hex(char(1))
select hex(char(1 using utf8));
hex(char(1 using utf8))
01
select char(0xd1,0x8f);
char(0xd1,0x8f)
select char(0xd1,0x8f using utf8);
char(0xd1,0x8f using utf8)
я
select char(0xd18f);
char(0xd18f)
select char(0xd18f using utf8);
char(0xd18f using utf8)
я
select char(53647);
char(53647)
select char(53647 using utf8);
char(53647 using utf8)
я
select char(0xff,0x8f);
char(0xff,0x8f)
select char(0xff,0x8f using utf8);
char(0xff,0x8f using utf8)
Warnings:
Warning 1300 Invalid utf8 character string: 'FF8F'
set sql_mode=traditional;
select char(0xff,0x8f);
char(0xff,0x8f)
select convert(char(0xff,0x8f) using utf8);
convert(char(0xff,0x8f) using utf8)
select char(195);
char(195)
select convert(char(195) using utf8);
convert(char(195) using utf8)
select char(196);
char(196)
select convert(char(196) using utf8);
convert(char(196) using utf8)
select char(0xff,0x8f using utf8);
char(0xff,0x8f using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'FF8F'
select char(195 using utf8);
char(195 using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'C3'
select char(196 using utf8);
char(196 using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'C4'
select char(2557 using utf8);
char(2557 using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'FD'
select hex(convert(char(2557 using latin1) using utf8));
hex(convert(char(2557 using latin1) using utf8))
09C3BD
select hex(char(195));
hex(char(195))
C3
select hex(char(196));
hex(char(196))
C4
select hex(char(2557));
hex(char(2557))
09FD
select hex(convert(char(2557) using utf8));
hex(convert(char(2557) using utf8))
09FD
set names utf8;
create table t1 (a char(1)) default character set utf8;
create table t2 (a char(1)) default character set utf8;
......
......@@ -871,22 +871,32 @@ DROP TABLE t1;
#
set names utf8;
# correct value
select hex(char(1));
select char(0xd1,0x8f);
select char(0xd18f);
select char(53647);
select hex(char(1 using utf8));
select char(0xd1,0x8f using utf8);
select char(0xd18f using utf8);
select char(53647 using utf8);
# incorrect value: return with warning
select char(0xff,0x8f);
select char(0xff,0x8f using utf8);
# incorrect value in strict mode: return NULL with "Error" level warning
set sql_mode=traditional;
select char(0xff,0x8f);
select convert(char(0xff,0x8f) using utf8);
select char(195);
select convert(char(195) using utf8);
select char(196);
select convert(char(196) using utf8);
select char(0xff,0x8f using utf8);
select char(195 using utf8);
select char(196 using utf8);
select char(2557 using utf8);
#
# Check convert + char + using
#
select hex(convert(char(2557 using latin1) using utf8));
#
# char() without USING returns "binary" by default, any argument is ok
#
select hex(char(195));
select hex(char(196));
select hex(char(2557));
select hex(convert(char(2557) using utf8));
#
# Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters
......
......@@ -480,12 +480,15 @@ public:
class Item_func_char :public Item_str_func
{
public:
Item_func_char(List<Item> &list) :Item_str_func(list) {}
Item_func_char(List<Item> &list) :Item_str_func(list)
{ collation.set(&my_charset_bin); }
Item_func_char(List<Item> &list, CHARSET_INFO *cs) :Item_str_func(list)
{ collation.set(cs); }
String *val_str(String *);
void fix_length_and_dec()
{
collation.set(&my_charset_bin);
maybe_null=0; max_length=arg_count;
maybe_null=0;
max_length=arg_count * collation.collation->mbmaxlen;
}
const char *func_name() const { return "char"; }
};
......
......@@ -4536,6 +4536,8 @@ simple_expr:
{ $$= new Item_func_atan($3,$5); }
| CHAR_SYM '(' expr_list ')'
{ $$= new Item_func_char(*$3); }
| CHAR_SYM '(' expr_list USING charset_name ')'
{ $$= new Item_func_char(*$3, $5); }
| CHARSET '(' expr ')'
{ $$= new Item_func_charset($3); }
| COALESCE '(' expr_list ')'
......
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