Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
8bd1ccc6
Commit
8bd1ccc6
authored
Oct 14, 2005
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge abarkov@bk-internal:/home/bk/mysql-5.0
into mysql.com:/usr/home/bar/mysql-5.0.char1
parents
63262cfd
fa0dec75
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
46 deletions
+71
-46
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+41
-31
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+22
-12
sql/item_strfunc.h
sql/item_strfunc.h
+6
-3
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-0
No files found.
mysql-test/r/ctype_utf8.result
View file @
8bd1ccc6
...
...
@@ -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;
...
...
mysql-test/t/ctype_utf8.test
View file @
8bd1ccc6
...
...
@@ -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
...
...
sql/item_strfunc.h
View file @
8bd1ccc6
...
...
@@ -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
)
;
ma
ybe_null
=
0
;
max_length
=
arg_count
;
maybe_null
=
0
;
ma
x_length
=
arg_count
*
collation
.
collation
->
mbmaxlen
;
}
const
char
*
func_name
()
const
{
return
"char"
;
}
};
...
...
sql/sql_yacc.yy
View file @
8bd1ccc6
...
...
@@ -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 ')'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment