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
47788e9e
Commit
47788e9e
authored
Oct 26, 2004
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Check ENUM/SET duplicate values taking in account charset/collation.
parent
6c4263ed
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
16 deletions
+37
-16
mysql-test/r/ctype_sjis.result
mysql-test/r/ctype_sjis.result
+13
-0
mysql-test/r/type_enum.result
mysql-test/r/type_enum.result
+0
-2
mysql-test/t/ctype_sjis.test
mysql-test/t/ctype_sjis.test
+10
-0
sql/sql_table.cc
sql/sql_table.cc
+14
-14
No files found.
mysql-test/r/ctype_sjis.result
View file @
47788e9e
...
@@ -47,3 +47,16 @@ select hex(a) from t1;
...
@@ -47,3 +47,16 @@ select hex(a) from t1;
hex(a)
hex(a)
878A
878A
drop table t1;
drop table t1;
create table t1(c enum(0x9353,0x9373) character set sjis);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` enum('S','s') character set sjis default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (0x9353);
insert into t1 values (0x9373);
select hex(c) from t1;
hex(c)
9353
9373
drop table t1;
mysql-test/r/type_enum.result
View file @
47788e9e
...
@@ -1678,8 +1678,6 @@ a int(11) YES 1
...
@@ -1678,8 +1678,6 @@ a int(11) YES 1
b enum('value','_value','') value
b enum('value','_value','') value
drop table t1;
drop table t1;
CREATE TABLE t1 (c enum('a', 'A') BINARY);
CREATE TABLE t1 (c enum('a', 'A') BINARY);
Warnings:
Note 1291 Column 'c' has duplicated value 'a' in ENUM
INSERT INTO t1 VALUES ('a'),('A');
INSERT INTO t1 VALUES ('a'),('A');
SELECT * FROM t1;
SELECT * FROM t1;
c
c
...
...
mysql-test/t/ctype_sjis.test
View file @
47788e9e
...
@@ -41,3 +41,13 @@ create table t1 (a char(10) character set sjis);
...
@@ -41,3 +41,13 @@ create table t1 (a char(10) character set sjis);
insert
into
t1
values
(
0x878A
);
insert
into
t1
values
(
0x878A
);
select
hex
(
a
)
from
t1
;
select
hex
(
a
)
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #6206 ENUMs are not case sensitive even if declared BINARY
#
create
table
t1
(
c
enum
(
0x9353
,
0x9373
)
character
set
sjis
);
show
create
table
t1
;
insert
into
t1
values
(
0x9353
);
insert
into
t1
values
(
0x9373
);
select
hex
(
c
)
from
t1
;
drop
table
t1
;
sql/sql_table.cc
View file @
47788e9e
...
@@ -370,19 +370,19 @@ static int sort_keys(KEY *a, KEY *b)
...
@@ -370,19 +370,19 @@ static int sort_keys(KEY *a, KEY *b)
*/
*/
void
check_duplicates_in_interval
(
const
char
*
set_or_name
,
void
check_duplicates_in_interval
(
const
char
*
set_or_name
,
const
char
*
name
,
TYPELIB
*
typelib
)
const
char
*
name
,
TYPELIB
*
typelib
,
CHARSET_INFO
*
cs
)
{
{
unsigned
int
old_count
=
typelib
->
count
;
TYPELIB
tmp
=
*
typelib
;
const
char
**
old_type_names
=
typelib
->
type_names
;
old_count
=
typelib
->
count
;
old_type_names
=
typelib
->
type_names
;
const
char
**
cur_value
=
typelib
->
type_names
;
const
char
**
cur_value
=
typelib
->
type_names
;
for
(
;
typelib
->
count
>
1
;
cur_value
++
)
unsigned
int
*
cur_length
=
typelib
->
type_lengths
;
for
(
;
tmp
.
count
>
1
;
cur_value
++
,
cur_length
++
)
{
{
typelib
->
type_names
++
;
tmp
.
type_names
++
;
typelib
->
count
--
;
tmp
.
type_lengths
++
;
if
(
find_type
((
char
*
)
*
cur_value
,
typelib
,
1
))
tmp
.
count
--
;
if
(
find_type2
(
&
tmp
,
(
const
char
*
)
*
cur_value
,
*
cur_length
,
cs
))
{
{
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_DUPLICATED_VALUE_IN_TYPE
,
ER_DUPLICATED_VALUE_IN_TYPE
,
...
@@ -390,8 +390,6 @@ void check_duplicates_in_interval(const char *set_or_name,
...
@@ -390,8 +390,6 @@ void check_duplicates_in_interval(const char *set_or_name,
name
,
*
cur_value
,
set_or_name
);
name
,
*
cur_value
,
set_or_name
);
}
}
}
}
typelib
->
count
=
old_count
;
typelib
->
type_names
=
old_type_names
;
}
}
/*
/*
...
@@ -571,7 +569,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -571,7 +569,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field
->
pack_flag
|=
FIELDFLAG_BINARY
;
sql_field
->
pack_flag
|=
FIELDFLAG_BINARY
;
sql_field
->
unireg_check
=
Field
::
INTERVAL_FIELD
;
sql_field
->
unireg_check
=
Field
::
INTERVAL_FIELD
;
check_duplicates_in_interval
(
"ENUM"
,
sql_field
->
field_name
,
check_duplicates_in_interval
(
"ENUM"
,
sql_field
->
field_name
,
sql_field
->
interval
);
sql_field
->
interval
,
sql_field
->
charset
);
break
;
break
;
case
FIELD_TYPE_SET
:
case
FIELD_TYPE_SET
:
sql_field
->
pack_flag
=
pack_length_to_packflag
(
sql_field
->
pack_length
)
|
sql_field
->
pack_flag
=
pack_length_to_packflag
(
sql_field
->
pack_length
)
|
...
@@ -580,7 +579,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -580,7 +579,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field
->
pack_flag
|=
FIELDFLAG_BINARY
;
sql_field
->
pack_flag
|=
FIELDFLAG_BINARY
;
sql_field
->
unireg_check
=
Field
::
BIT_FIELD
;
sql_field
->
unireg_check
=
Field
::
BIT_FIELD
;
check_duplicates_in_interval
(
"SET"
,
sql_field
->
field_name
,
check_duplicates_in_interval
(
"SET"
,
sql_field
->
field_name
,
sql_field
->
interval
);
sql_field
->
interval
,
sql_field
->
charset
);
break
;
break
;
case
FIELD_TYPE_DATE
:
// Rest of string types
case
FIELD_TYPE_DATE
:
// Rest of string types
case
FIELD_TYPE_NEWDATE
:
case
FIELD_TYPE_NEWDATE
:
...
...
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