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
2ba7c517
Commit
2ba7c517
authored
Dec 21, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#7302: UCS2 data in ENUM field get truncated when new column is added
parent
c6b6977b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
19 deletions
+71
-19
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+11
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+10
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/strfunc.cc
sql/strfunc.cc
+37
-0
sql/table.cc
sql/table.cc
+1
-19
sql/unireg.cc
sql/unireg.cc
+11
-0
No files found.
mysql-test/r/ctype_ucs.result
View file @
2ba7c517
...
...
@@ -581,3 +581,14 @@ x,y 0078002C0079
z 007A
x,y,z,,, 0078002C0079002C007A002C00E4002C00F6002C00FC
drop table t1;
create table t1(a enum('a','b','c')) default character set ucs2;
insert into t1 values('a'),('b'),('c');
alter table t1 add b char(1);
show warnings;
Level Code Message
select * from t1 order by a;
a b
a NULL
b NULL
c NULL
drop table t1;
mysql-test/t/ctype_ucs.test
View file @
2ba7c517
...
...
@@ -374,3 +374,13 @@ insert into t1 values ('x,y');
insert
into
t1
values
(
'x,y,z,,,'
);
select
a
,
hex
(
a
)
from
t1
order
by
a
;
drop
table
t1
;
#
# Bug#7302 UCS2 data in ENUM fields get truncated when new column is added
#
create
table
t1
(
a
enum
(
'a'
,
'b'
,
'c'
))
default
character
set
ucs2
;
insert
into
t1
values
(
'a'
),(
'b'
),(
'c'
);
alter
table
t1
add
b
char
(
1
);
show
warnings
;
select
*
from
t1
order
by
a
;
drop
table
t1
;
sql/mysql_priv.h
View file @
2ba7c517
...
...
@@ -815,6 +815,7 @@ ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
char
**
err_pos
,
uint
*
err_len
,
bool
*
set_warning
);
uint
find_type
(
TYPELIB
*
lib
,
const
char
*
find
,
uint
length
,
bool
part_match
);
uint
find_type2
(
TYPELIB
*
lib
,
const
char
*
find
,
uint
length
,
CHARSET_INFO
*
cs
);
void
unhex_type2
(
TYPELIB
*
lib
);
uint
check_word
(
TYPELIB
*
lib
,
const
char
*
val
,
const
char
*
end
,
const
char
**
end_of_word
);
...
...
sql/strfunc.cc
View file @
2ba7c517
...
...
@@ -169,6 +169,43 @@ uint find_type2(TYPELIB *typelib, const char *x, uint length, CHARSET_INFO *cs)
}
/* find_type */
/*
Un-hex all elements in a typelib
SYNOPSIS
unhex_type2()
interval TYPELIB (struct of pointer to values + lengths + count)
NOTES
RETURN
N/A
*/
void
unhex_type2
(
TYPELIB
*
interval
)
{
for
(
uint
pos
=
0
;
pos
<
interval
->
count
;
pos
++
)
{
char
*
from
,
*
to
;
for
(
from
=
to
=
(
char
*
)
interval
->
type_names
[
pos
];
*
from
;
)
{
/*
Note, hexchar_to_int(*from++) doesn't work
one some compilers, e.g. IRIX. Looks like a compiler
bug in inline functions in combination with arguments
that have a side effect. So, let's use from[0] and from[1]
and increment 'from' by two later.
*/
*
to
++=
(
char
)
(
hexchar_to_int
(
from
[
0
])
<<
4
)
+
hexchar_to_int
(
from
[
1
]);
from
+=
2
;
}
interval
->
type_lengths
[
pos
]
/=
2
;
}
}
/*
Check if the first word in a string is one of the ones in TYPELIB
...
...
sql/table.cc
View file @
2ba7c517
...
...
@@ -490,25 +490,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
{
/* Unescape UCS2 intervals from HEX notation */
TYPELIB
*
interval
=
outparam
->
intervals
+
interval_nr
-
1
;
for
(
uint
pos
=
0
;
pos
<
interval
->
count
;
pos
++
)
{
char
*
from
,
*
to
;
for
(
from
=
to
=
(
char
*
)
interval
->
type_names
[
pos
];
*
from
;
)
{
/*
Note, hexchar_to_int(*from++) doesn't work
one some compilers, e.g. IRIX. Looks like a compiler
bug in inline functions in combination with arguments
that have a side effect. So, let's use from[0] and from[1]
and increment 'from' by two later.
*/
*
to
++=
(
char
)
(
hexchar_to_int
(
from
[
0
])
<<
4
)
+
hexchar_to_int
(
from
[
1
]);
from
+=
2
;
}
interval
->
type_lengths
[
pos
]
/=
2
;
}
unhex_type2
(
interval
);
}
*
field_ptr
=
reg_field
=
...
...
sql/unireg.cc
View file @
2ba7c517
...
...
@@ -174,6 +174,17 @@ bool mysql_create_frm(THD *thd, my_string file_name,
goto
err2
;
if
(
my_close
(
file
,
MYF
(
MY_WME
)))
goto
err3
;
{
/* Unescape all UCS2 intervals: were escaped in pack_headers */
List_iterator
<
create_field
>
it
(
create_fields
);
create_field
*
field
;
while
((
field
=
it
++
))
{
if
(
field
->
interval
&&
field
->
charset
->
mbminlen
>
1
)
unhex_type2
(
field
->
interval
);
}
}
DBUG_RETURN
(
0
);
err:
...
...
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