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
8c8883ae
Commit
8c8883ae
authored
Jul 04, 2007
by
tsmith@maint1.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge maint1.mysql.com:/data/localhome/tsmith/bk/41
into maint1.mysql.com:/data/localhome/tsmith/bk/maint/41
parents
2bfa624a
f8bf427b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletion
+56
-1
mysql-test/r/type_enum.result
mysql-test/r/type_enum.result
+23
-0
mysql-test/t/type_enum.test
mysql-test/t/type_enum.test
+17
-0
sql/field_conv.cc
sql/field_conv.cc
+16
-1
No files found.
mysql-test/r/type_enum.result
View file @
8c8883ae
...
...
@@ -1778,4 +1778,27 @@ drop table t1;
create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
!"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\','zz'));
ERROR 42000: Field separator argument is not what is expected; check the manual
CREATE TABLE t1 (
id INT AUTO_INCREMENT PRIMARY KEY,
c1 ENUM('a', '', 'b')
);
INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
SELECT id, c1 + 0, c1 FROM t1;
id c1 + 0 c1
1 0
2 1 a
3 2
4 3 b
ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 4
SELECT id, c1 + 0, c1 FROM t1;
id c1 + 0 c1
1 0
2 1 a
3 2
4 0
DROP TABLE t1;
End of 4.1 tests
...
...
mysql-test/t/type_enum.test
View file @
8c8883ae
...
...
@@ -156,4 +156,21 @@ drop table t1;
create
table
t1
(
exhausting_charset
enum
(
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
,
'
!"'
,
'#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
,
'xx\'
,
'yy\','
zz
'));
#
# Bug #29251: MySQL coerces special 0 enum values to normal '' value
# when ALTERing the column
#
CREATE TABLE t1 (
id INT AUTO_INCREMENT PRIMARY KEY,
c1 ENUM('
a
', '', '
b
')
);
INSERT INTO t1 (c1) VALUES (0), ('
a
'), (''), ('
b
');
SELECT id, c1 + 0, c1 FROM t1;
ALTER TABLE t1 CHANGE c1 c1 ENUM('
a
', '
'
)
NOT
NULL
;
SELECT
id
,
c1
+
0
,
c1
FROM
t1
;
DROP
TABLE
t1
;
--
echo
End
of
4.1
tests
...
...
sql/field_conv.cc
View file @
8c8883ae
...
...
@@ -311,6 +311,15 @@ static void do_field_string(Copy_field *copy)
}
static
void
do_field_enum
(
Copy_field
*
copy
)
{
if
(
copy
->
from_field
->
val_int
()
==
0
)
((
Field_enum
*
)
copy
->
to_field
)
->
store_type
((
ulonglong
)
0
);
else
do_field_string
(
copy
);
}
static
void
do_field_int
(
Copy_field
*
copy
)
{
longlong
value
=
copy
->
from_field
->
val_int
();
...
...
@@ -538,8 +547,14 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
to
->
real_type
()
==
FIELD_TYPE_SET
)
{
if
(
!
to
->
eq_def
(
from
))
{
if
(
from
->
real_type
()
==
MYSQL_TYPE_ENUM
&&
to
->
real_type
()
==
MYSQL_TYPE_ENUM
)
return
do_field_enum
;
else
return
do_field_string
;
}
}
else
if
(
to
->
charset
()
!=
from
->
charset
())
return
do_field_string
;
else
if
(
to
->
real_type
()
==
FIELD_TYPE_VAR_STRING
&&
to_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