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
6f0c8a7b
Commit
6f0c8a7b
authored
Dec 25, 2003
by
bar@bar.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 2202: CAST from binary to char still returns a binary string
parent
37467ebe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
1 deletion
+31
-1
mysql-test/r/cast.result
mysql-test/r/cast.result
+15
-0
mysql-test/t/cast.test
mysql-test/t/cast.test
+13
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+2
-0
sql/sql_string.cc
sql/sql_string.cc
+1
-1
No files found.
mysql-test/r/cast.result
View file @
6f0c8a7b
...
...
@@ -101,6 +101,21 @@ t1 CREATE TABLE `t1` (
`c5` char(2) character set utf8 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a binary(10), b char(10) character set koi8r);
insert into t1 values (_binary'',_binary'');
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
a b cast(a as char character set cp1251) cast(b as binary)
set names koi8r;
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
a b cast(a as char character set cp1251) cast(b as binary)
set names cp1251;
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
a b cast(a as char character set cp1251) cast(b as binary)
drop table t1;
set names binary;
select cast("2001-1-1" as date) = "2001-01-01";
cast("2001-1-1" as date) = "2001-01-01"
1
...
...
mysql-test/t/cast.test
View file @
6f0c8a7b
...
...
@@ -64,6 +64,19 @@ select * from t1;
show
create
table
t1
;
drop
table
t1
;
#
# Bug 2202
# CAST from BINARY to non-BINARY and from non-BINARY to BINARY
#
create
table
t1
(
a
binary
(
10
),
b
char
(
10
)
character
set
koi8r
);
insert
into
t1
values
(
_binary
''
,
_binary
''
);
select
a
,
b
,
cast
(
a
as
char
character
set
cp1251
),
cast
(
b
as
binary
)
from
t1
;
set
names
koi8r
;
select
a
,
b
,
cast
(
a
as
char
character
set
cp1251
),
cast
(
b
as
binary
)
from
t1
;
set
names
cp1251
;
select
a
,
b
,
cast
(
a
as
char
character
set
cp1251
),
cast
(
b
as
binary
)
from
t1
;
drop
table
t1
;
set
names
binary
;
#
# The following should be fixed in 4.1
...
...
sql/item_timefunc.cc
View file @
6f0c8a7b
...
...
@@ -1848,6 +1848,8 @@ String *Item_char_typecast::val_str(String *str)
}
res
=
str
;
}
res
->
set_charset
(
cast_cs
);
/*
Cut the tail if cast with length
...
...
sql/sql_string.cc
View file @
6f0c8a7b
...
...
@@ -235,7 +235,7 @@ bool String::copy(const char *str, uint32 arg_length,
{
if
((
from_cs
==
&
my_charset_bin
)
||
(
to_cs
==
&
my_charset_bin
))
{
return
copy
(
str
,
arg_length
,
&
my_charset_bin
);
return
copy
(
str
,
arg_length
,
to_cs
);
}
uint32
new_length
=
to_cs
->
mbmaxlen
*
arg_length
;
if
(
alloc
(
new_length
))
...
...
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