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
b6a808bd
Commit
b6a808bd
authored
Oct 29, 2007
by
ramil/ram@ramil.myoffice.izhnet.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/ram/work/b31137/b31137.5.0
into mysql.com:/home/ram/work/b31137/b31137.5.1
parents
1317a63b
8ec674dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
9 deletions
+21
-9
include/my_base.h
include/my_base.h
+2
-0
sql/sql_table.cc
sql/sql_table.cc
+18
-8
sql/structs.h
sql/structs.h
+1
-1
No files found.
include/my_base.h
View file @
b6a808bd
...
...
@@ -244,6 +244,8 @@ enum ha_base_keytype {
HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
#define HA_KEY_HAS_PART_KEY_SEG 65536
/* Key contains partial segments */
/* Automatic bits in key-flag */
#define HA_SPACE_PACK_USED 4
/* Test for if SPACE_PACK used */
...
...
sql/sql_table.cc
View file @
b6a808bd
...
...
@@ -1782,7 +1782,8 @@ bool quick_rm_table(handlerton *base,const char *db,
/*
Sort keys in the following order:
- PRIMARY KEY
- UNIQUE keyws where all column are NOT NULL
- UNIQUE keys where all column are NOT NULL
- UNIQUE keys that don't contain partial segments
- Other UNIQUE keys
- Normal keys
- Fulltext keys
...
...
@@ -1793,26 +1794,31 @@ bool quick_rm_table(handlerton *base,const char *db,
static
int
sort_keys
(
KEY
*
a
,
KEY
*
b
)
{
if
(
a
->
flags
&
HA_NOSAME
)
ulong
a_flags
=
a
->
flags
,
b_flags
=
b
->
flags
;
if
(
a_flags
&
HA_NOSAME
)
{
if
(
!
(
b
->
flags
&
HA_NOSAME
))
if
(
!
(
b
_
flags
&
HA_NOSAME
))
return
-
1
;
if
((
a
->
flags
^
b
->
flags
)
&
(
HA_NULL_PART_KEY
|
HA_END_SPACE_KEY
))
if
((
a
_flags
^
b_
flags
)
&
(
HA_NULL_PART_KEY
|
HA_END_SPACE_KEY
))
{
/* Sort NOT NULL keys before other keys */
return
(
a
->
flags
&
(
HA_NULL_PART_KEY
|
HA_END_SPACE_KEY
))
?
1
:
-
1
;
return
(
a
_
flags
&
(
HA_NULL_PART_KEY
|
HA_END_SPACE_KEY
))
?
1
:
-
1
;
}
if
(
a
->
name
==
primary_key_name
)
return
-
1
;
if
(
b
->
name
==
primary_key_name
)
return
1
;
/* Sort keys don't containing partial segments before others */
if
((
a_flags
^
b_flags
)
&
HA_KEY_HAS_PART_KEY_SEG
)
return
(
a_flags
&
HA_KEY_HAS_PART_KEY_SEG
)
?
1
:
-
1
;
}
else
if
(
b
->
flags
&
HA_NOSAME
)
else
if
(
b
_
flags
&
HA_NOSAME
)
return
1
;
// Prefer b
if
((
a
->
flags
^
b
->
flags
)
&
HA_FULLTEXT
)
if
((
a
_flags
^
b_
flags
)
&
HA_FULLTEXT
)
{
return
(
a
->
flags
&
HA_FULLTEXT
)
?
1
:
-
1
;
return
(
a
_
flags
&
HA_FULLTEXT
)
?
1
:
-
1
;
}
/*
Prefer original key order. usable_key_parts contains here
...
...
@@ -2876,6 +2882,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
else
key_info
->
flags
|=
HA_PACK_KEY
;
}
/* Check if the key segment is partial, set the key flag accordingly */
if
(
length
!=
sql_field
->
key_length
)
key_info
->
flags
|=
HA_KEY_HAS_PART_KEY_SEG
;
key_length
+=
length
;
key_part_info
++
;
...
...
sql/structs.h
View file @
b6a808bd
...
...
@@ -71,7 +71,7 @@ typedef struct st_key_part_info { /* Info about a key part */
typedef
struct
st_key
{
uint
key_length
;
/* Tot length of key */
u
int
flags
;
/* dupp key and pack flags */
u
long
flags
;
/* dupp key and pack flags */
uint
key_parts
;
/* How many key_parts */
uint
extra_length
;
uint
usable_key_parts
;
/* Should normally be = key_parts */
...
...
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