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
f55b05e2
Commit
f55b05e2
authored
Sep 15, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In CREATE syntax: KEY a (field_name(10))
10 now means "number of characters", not number of bytes.
parent
9a5e82ad
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
3 deletions
+51
-3
mysql-test/r/ctype_mb.result
mysql-test/r/ctype_mb.result
+31
-0
mysql-test/t/ctype_mb.test
mysql-test/t/ctype_mb.test
+11
-0
sql/sql_show.cc
sql/sql_show.cc
+3
-1
sql/sql_table.cc
sql/sql_table.cc
+6
-2
No files found.
mysql-test/r/ctype_mb.result
View file @
f55b05e2
...
@@ -19,3 +19,34 @@ SELECT * FROM t1;
...
@@ -19,3 +19,34 @@ SELECT * FROM t1;
c1 c2 c3
c1 c2 c3
aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc
aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(4) character set utf8 default NULL,
KEY `key_a` (`a`(3))
) TYPE=MyISAM CHARSET=latin1
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 key_a 1 a A NULL 9 NULL YES BTREE
ALTER TABLE t1 CHANGE a a CHAR(4);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(4) default NULL,
KEY `key_a` (`a`(3))
) TYPE=MyISAM CHARSET=latin1
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 key_a 1 a A NULL 3 NULL YES BTREE
ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(4) character set utf8 default NULL,
KEY `key_a` (`a`(3))
) TYPE=MyISAM CHARSET=latin1
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 key_a 1 a A NULL 9 NULL YES BTREE
DROP TABLE t1;
mysql-test/t/ctype_mb.test
View file @
f55b05e2
...
@@ -6,3 +6,14 @@ SHOW CREATE TABLE t1;
...
@@ -6,3 +6,14 @@ SHOW CREATE TABLE t1;
INSERT
INTO
t1
VALUES
(
'aaaabbbbccccdddd'
,
'aaaabbbbccccdddd'
,
'aaaabbbbccccdddd'
);
INSERT
INTO
t1
VALUES
(
'aaaabbbbccccdddd'
,
'aaaabbbbccccdddd'
,
'aaaabbbbccccdddd'
);
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
CHAR
(
4
)
CHARACTER
SET
utf8
,
KEY
key_a
(
a
(
3
)));
SHOW
CREATE
TABLE
t1
;
SHOW
KEYS
FROM
t1
;
ALTER
TABLE
t1
CHANGE
a
a
CHAR
(
4
);
SHOW
CREATE
TABLE
t1
;
SHOW
KEYS
FROM
t1
;
ALTER
TABLE
t1
CHANGE
a
a
CHAR
(
4
)
CHARACTER
SET
utf8
;
SHOW
CREATE
TABLE
t1
;
SHOW
KEYS
FROM
t1
;
DROP
TABLE
t1
;
sql/sql_show.cc
View file @
f55b05e2
...
@@ -1214,7 +1214,9 @@ store_create_info(THD *thd, TABLE *table, String *packet)
...
@@ -1214,7 +1214,9 @@ store_create_info(THD *thd, TABLE *table, String *packet)
!
(
key_info
->
flags
&
HA_FULLTEXT
)))
!
(
key_info
->
flags
&
HA_FULLTEXT
)))
{
{
buff
[
0
]
=
'('
;
buff
[
0
]
=
'('
;
char
*
end
=
int10_to_str
((
long
)
key_part
->
length
,
buff
+
1
,
10
);
char
*
end
=
int10_to_str
((
long
)
key_part
->
length
/
key_part
->
field
->
charset
()
->
mbmaxlen
,
buff
+
1
,
10
);
*
end
++
=
')'
;
*
end
++
=
')'
;
packet
->
append
(
buff
,(
uint
)
(
end
-
buff
));
packet
->
append
(
buff
,(
uint
)
(
end
-
buff
));
}
}
...
...
sql/sql_table.cc
View file @
f55b05e2
...
@@ -729,6 +729,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -729,6 +729,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
*/
*/
if
(
key
->
type
==
Key
::
FULLTEXT
)
if
(
key
->
type
==
Key
::
FULLTEXT
)
column
->
length
=
test
(
f_is_blob
(
sql_field
->
pack_flag
));
column
->
length
=
test
(
f_is_blob
(
sql_field
->
pack_flag
));
else
column
->
length
*=
sql_field
->
charset
->
mbmaxlen
;
if
(
f_is_blob
(
sql_field
->
pack_flag
))
if
(
f_is_blob
(
sql_field
->
pack_flag
))
{
{
if
(
!
(
file
->
table_flags
()
&
HA_BLOB_KEY
))
if
(
!
(
file
->
table_flags
()
&
HA_BLOB_KEY
))
...
@@ -2099,10 +2102,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -2099,10 +2102,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
// Check if sub key
{
// Check if sub key
if
(
cfield
->
field
->
type
()
!=
FIELD_TYPE_BLOB
&&
if
(
cfield
->
field
->
type
()
!=
FIELD_TYPE_BLOB
&&
(
cfield
->
field
->
pack_length
()
==
key_part_length
||
(
cfield
->
field
->
pack_length
()
==
key_part_length
||
cfield
->
length
!=
cfield
->
pack_length
||
cfield
->
length
<=
key_part_length
/
cfield
->
pack_length
<=
key_part_length
))
key_part
->
field
->
charset
()
->
mbmaxlen
))
key_part_length
=
0
;
// Use whole field
key_part_length
=
0
;
// Use whole field
}
}
key_part_length
/=
key_part
->
field
->
charset
()
->
mbmaxlen
;
key_parts
.
push_back
(
new
key_part_spec
(
cfield
->
field_name
,
key_parts
.
push_back
(
new
key_part_spec
(
cfield
->
field_name
,
key_part_length
));
key_part_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