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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c672c119
Commit
c672c119
authored
Mar 02, 2006
by
cmiller@zippy.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expanding a binary field should result in 0x00-filled positions, not 0x20
(ASCII space). For Bug#16857.
parent
d85e9295
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletion
+48
-1
mysql-test/r/binary.result
mysql-test/r/binary.result
+19
-0
mysql-test/t/binary.test
mysql-test/t/binary.test
+12
-0
sql/field_conv.cc
sql/field_conv.cc
+17
-1
No files found.
mysql-test/r/binary.result
View file @
c672c119
...
@@ -141,3 +141,22 @@ t1 CREATE TABLE `t1` (
...
@@ -141,3 +141,22 @@ t1 CREATE TABLE `t1` (
`a` binary(1) default NULL
`a` binary(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop table t1;
create table t1 (col1 binary(4));
insert into t1 values ('a'),('a ');
select hex(col1) from t1;
hex(col1)
61000000
61200000
alter table t1 modify col1 binary(10);
select hex(col1) from t1;
hex(col1)
61000000000000000000
61200000000000000000
insert into t1 values ('b'),('b ');
select hex(col1) from t1;
hex(col1)
61000000000000000000
61200000000000000000
62000000000000000000
62200000000000000000
drop table t1;
mysql-test/t/binary.test
View file @
c672c119
...
@@ -89,3 +89,15 @@ show create table t1;
...
@@ -89,3 +89,15 @@ show create table t1;
drop
table
t1
;
drop
table
t1
;
# End of 4.1 tests
# End of 4.1 tests
#
# Bug#16857
#
create
table
t1
(
col1
binary
(
4
));
insert
into
t1
values
(
'a'
),(
'a '
);
select
hex
(
col1
)
from
t1
;
alter
table
t1
modify
col1
binary
(
10
);
select
hex
(
col1
)
from
t1
;
insert
into
t1
values
(
'b'
),(
'b '
);
select
hex
(
col1
)
from
t1
;
drop
table
t1
;
sql/field_conv.cc
View file @
c672c119
...
@@ -379,6 +379,16 @@ static void do_cut_string_complex(Copy_field *copy)
...
@@ -379,6 +379,16 @@ static void do_cut_string_complex(Copy_field *copy)
static
void
do_expand_binary
(
Copy_field
*
copy
)
{
CHARSET_INFO
*
cs
=
copy
->
from_field
->
charset
();
memcpy
(
copy
->
to_ptr
,
copy
->
from_ptr
,
copy
->
from_length
);
cs
->
cset
->
fill
(
cs
,
copy
->
to_ptr
+
copy
->
from_length
,
copy
->
to_length
-
copy
->
from_length
,
'\0'
);
}
static
void
do_expand_string
(
Copy_field
*
copy
)
static
void
do_expand_string
(
Copy_field
*
copy
)
{
{
CHARSET_INFO
*
cs
=
copy
->
from_field
->
charset
();
CHARSET_INFO
*
cs
=
copy
->
from_field
->
charset
();
...
@@ -583,7 +593,13 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
...
@@ -583,7 +593,13 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
return
(
from
->
charset
()
->
mbmaxlen
==
1
?
return
(
from
->
charset
()
->
mbmaxlen
==
1
?
do_cut_string
:
do_cut_string_complex
);
do_cut_string
:
do_cut_string_complex
);
else
if
(
to_length
>
from_length
)
else
if
(
to_length
>
from_length
)
return
do_expand_string
;
{
if
((
to
->
flags
&
BINARY_FLAG
)
!=
0
)
return
do_expand_binary
;
else
return
do_expand_string
;
}
}
}
else
if
(
to
->
real_type
()
!=
from
->
real_type
()
||
else
if
(
to
->
real_type
()
!=
from
->
real_type
()
||
to_length
!=
from_length
||
to_length
!=
from_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