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
08738d28
Commit
08738d28
authored
Jun 30, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fowwlowup fixes for index_flags()
parent
a9946825
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
23 deletions
+23
-23
sql/ha_berkeley.h
sql/ha_berkeley.h
+1
-2
sql/handler.h
sql/handler.h
+1
-1
sql/opt_sum.cc
sql/opt_sum.cc
+7
-6
sql/sql_select.cc
sql/sql_select.cc
+7
-4
sql/sql_show.cc
sql/sql_show.cc
+1
-1
sql/table.cc
sql/table.cc
+6
-9
No files found.
sql/ha_berkeley.h
View file @
08738d28
...
@@ -97,8 +97,7 @@ class ha_berkeley: public handler
...
@@ -97,8 +97,7 @@ class ha_berkeley: public handler
ulong
index_flags
(
uint
idx
,
uint
part
)
const
ulong
index_flags
(
uint
idx
,
uint
part
)
const
{
{
ulong
flags
=
HA_READ_NEXT
|
HA_READ_PREV
;
ulong
flags
=
HA_READ_NEXT
|
HA_READ_PREV
;
if
(
part
==
(
uint
)
~
0
||
if
(
table
->
key_info
[
idx
].
key_part
[
part
].
field
->
key_type
()
!=
HA_KEYTYPE_TEXT
)
table
->
key_info
[
idx
].
key_part
[
part
].
field
->
key_type
()
!=
HA_KEYTYPE_TEXT
)
flags
|=
HA_READ_ORDER
|
HA_KEYREAD_ONLY
|
HA_READ_RANGE
;
flags
|=
HA_READ_ORDER
|
HA_KEYREAD_ONLY
|
HA_READ_RANGE
;
return
flags
;
return
flags
;
}
}
...
...
sql/handler.h
View file @
08738d28
...
@@ -449,7 +449,7 @@ class handler :public Sql_alloc
...
@@ -449,7 +449,7 @@ class handler :public Sql_alloc
virtual
const
char
*
table_type
()
const
=
0
;
virtual
const
char
*
table_type
()
const
=
0
;
virtual
const
char
**
bas_ext
()
const
=
0
;
virtual
const
char
**
bas_ext
()
const
=
0
;
virtual
ulong
table_flags
(
void
)
const
=
0
;
virtual
ulong
table_flags
(
void
)
const
=
0
;
virtual
ulong
index_flags
(
uint
idx
,
uint
part
=
~
0
)
const
=
0
;
virtual
ulong
index_flags
(
uint
idx
,
uint
part
=
0
)
const
=
0
;
virtual
ulong
index_ddl_flags
(
KEY
*
wanted_index
)
const
virtual
ulong
index_ddl_flags
(
KEY
*
wanted_index
)
const
{
return
(
HA_DDL_SUPPORT
);
}
{
return
(
HA_DDL_SUPPORT
);
}
virtual
int
add_index
(
TABLE
*
table_arg
,
KEY
*
key_info
,
uint
num_of_keys
)
virtual
int
add_index
(
TABLE
*
table_arg
,
KEY
*
key_info
,
uint
num_of_keys
)
...
...
sql/opt_sum.cc
View file @
08738d28
...
@@ -629,7 +629,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
...
@@ -629,7 +629,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
if
(
!
(
field
->
flags
&
PART_KEY_FLAG
))
if
(
!
(
field
->
flags
&
PART_KEY_FLAG
))
return
0
;
// Not key field
return
0
;
// Not key field
*
prefix_len
=
0
;
*
prefix_len
=
0
;
TABLE
*
table
=
field
->
table
;
TABLE
*
table
=
field
->
table
;
uint
idx
=
0
;
uint
idx
=
0
;
...
@@ -637,16 +637,17 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
...
@@ -637,16 +637,17 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
for
(
keyinfo
=
table
->
key_info
,
keyinfo_end
=
keyinfo
+
table
->
keys
;
for
(
keyinfo
=
table
->
key_info
,
keyinfo_end
=
keyinfo
+
table
->
keys
;
keyinfo
!=
keyinfo_end
;
keyinfo
!=
keyinfo_end
;
keyinfo
++
,
idx
++
)
keyinfo
++
,
idx
++
)
{
{
if
(
!
(
table
->
file
->
index_flags
(
idx
)
&
HA_READ_ORDER
))
break
;
KEY_PART_INFO
*
part
,
*
part_end
;
KEY_PART_INFO
*
part
,
*
part_end
;
key_part_map
key_part_to_use
=
0
;
key_part_map
key_part_to_use
=
0
;
uint
jdx
=
0
;
for
(
part
=
keyinfo
->
key_part
,
part_end
=
part
+
keyinfo
->
key_parts
;
for
(
part
=
keyinfo
->
key_part
,
part_end
=
part
+
keyinfo
->
key_parts
;
part
!=
part_end
;
part
!=
part_end
;
part
++
,
key_part_to_use
=
(
key_part_to_use
<<
1
)
|
1
)
part
++
,
jdx
++
,
key_part_to_use
=
(
key_part_to_use
<<
1
)
|
1
)
{
{
if
(
!
(
table
->
file
->
index_flags
(
idx
,
jdx
)
&
HA_READ_ORDER
))
return
0
;
if
(
field
->
eq
(
part
->
field
))
if
(
field
->
eq
(
part
->
field
))
{
{
ref
->
key
=
idx
;
ref
->
key
=
idx
;
...
...
sql/sql_select.cc
View file @
08738d28
...
@@ -2825,7 +2825,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
...
@@ -2825,7 +2825,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
Set tmp to (previous record count) * (records / combination)
Set tmp to (previous record count) * (records / combination)
*/
*/
if
((
found_part
&
1
)
&&
if
((
found_part
&
1
)
&&
(
!
(
table
->
file
->
index_flags
(
key
)
&
HA_ONLY_WHOLE_INDEX
)
||
(
!
(
table
->
file
->
index_flags
(
key
,
0
)
&
HA_ONLY_WHOLE_INDEX
)
||
found_part
==
PREV_BITS
(
uint
,
keyinfo
->
key_parts
)))
found_part
==
PREV_BITS
(
uint
,
keyinfo
->
key_parts
)))
{
{
max_key_part
=
max_part_bit
(
found_part
);
max_key_part
=
max_part_bit
(
found_part
);
...
@@ -7171,7 +7171,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
...
@@ -7171,7 +7171,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
*/
if
(
!
select
->
quick
->
reverse_sorted
())
if
(
!
select
->
quick
->
reverse_sorted
())
{
{
if
(
!
(
table
->
file
->
index_flags
(
ref_key
)
&
HA_READ_PREV
))
// here used_key_parts >0
if
(
!
(
table
->
file
->
index_flags
(
ref_key
,
used_key_parts
-
1
)
&
HA_READ_PREV
))
DBUG_RETURN
(
0
);
// Use filesort
DBUG_RETURN
(
0
);
// Use filesort
// ORDER BY range_key DESC
// ORDER BY range_key DESC
QUICK_SELECT_DESC
*
tmp
=
new
QUICK_SELECT_DESC
(
select
->
quick
,
QUICK_SELECT_DESC
*
tmp
=
new
QUICK_SELECT_DESC
(
select
->
quick
,
...
@@ -7193,8 +7195,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
...
@@ -7193,8 +7195,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
Use a traversal function that starts by reading the last row
Use a traversal function that starts by reading the last row
with key part (A) and then traverse the index backwards.
with key part (A) and then traverse the index backwards.
*/
*/
if
(
!
(
table
->
file
->
index_flags
(
ref_key
)
&
HA_READ_PREV
))
if
(
!
(
table
->
file
->
index_flags
(
ref_key
,
used_key_parts
-
1
)
DBUG_RETURN
(
0
);
// Use filesort
&
HA_READ_PREV
))
DBUG_RETURN
(
0
);
// Use filesort
tab
->
read_first_record
=
join_read_last_key
;
tab
->
read_first_record
=
join_read_last_key
;
tab
->
read_record
.
read_record
=
join_read_prev_same
;
tab
->
read_record
.
read_record
=
join_read_prev_same
;
/* fall through */
/* fall through */
...
...
sql/sql_show.cc
View file @
08738d28
...
@@ -995,7 +995,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
...
@@ -995,7 +995,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
str
=
(
key_part
->
field
?
key_part
->
field
->
field_name
:
str
=
(
key_part
->
field
?
key_part
->
field
->
field_name
:
"?unknown field?"
);
"?unknown field?"
);
protocol
->
store
(
str
,
system_charset_info
);
protocol
->
store
(
str
,
system_charset_info
);
if
(
table
->
file
->
index_flags
(
i
)
&
HA_READ_ORDER
)
if
(
table
->
file
->
index_flags
(
i
,
j
)
&
HA_READ_ORDER
)
protocol
->
store
(((
key_part
->
key_part_flag
&
HA_REVERSE_SORT
)
?
protocol
->
store
(((
key_part
->
key_part_flag
&
HA_REVERSE_SORT
)
?
"D"
:
"A"
),
1
,
system_charset_info
);
"D"
:
"A"
),
1
,
system_charset_info
);
else
else
...
...
sql/table.cc
View file @
08738d28
...
@@ -167,9 +167,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
...
@@ -167,9 +167,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam
->
keys
=
keys
=
disk_buff
[
0
];
outparam
->
keys
=
keys
=
disk_buff
[
0
];
outparam
->
key_parts
=
key_parts
=
disk_buff
[
1
];
outparam
->
key_parts
=
key_parts
=
disk_buff
[
1
];
}
}
outparam
->
keys_for_keyread
.
init
(
keys
);
outparam
->
keys_for_keyread
.
init
(
0
);
outparam
->
keys_in_use
.
init
(
keys
);
outparam
->
keys_in_use
.
init
(
keys
);
outparam
->
read_only_keys
.
init
(
0
);
outparam
->
read_only_keys
.
init
(
keys
);
outparam
->
quick_keys
.
init
();
outparam
->
quick_keys
.
init
();
outparam
->
used_keys
.
init
();
outparam
->
used_keys
.
init
();
outparam
->
keys_in_use_for_query
.
init
();
outparam
->
keys_in_use_for_query
.
init
();
...
@@ -500,13 +500,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
...
@@ -500,13 +500,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if
(
outparam
->
key_info
[
key
].
flags
&
HA_FULLTEXT
)
if
(
outparam
->
key_info
[
key
].
flags
&
HA_FULLTEXT
)
outparam
->
key_info
[
key
].
algorithm
=
HA_KEY_ALG_FULLTEXT
;
outparam
->
key_info
[
key
].
algorithm
=
HA_KEY_ALG_FULLTEXT
;
/* This has to be done after the above fulltext correction */
if
(
!
(
outparam
->
file
->
index_flags
(
key
)
&
HA_KEYREAD_ONLY
))
{
outparam
->
read_only_keys
.
set_bit
(
key
);
outparam
->
keys_for_keyread
.
clear_bit
(
key
);
}
if
(
primary_key
>=
MAX_KEY
&&
(
keyinfo
->
flags
&
HA_NOSAME
))
if
(
primary_key
>=
MAX_KEY
&&
(
keyinfo
->
flags
&
HA_NOSAME
))
{
{
/*
/*
...
@@ -577,7 +570,11 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
...
@@ -577,7 +570,11 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
!
(
field
->
flags
&
BLOB_FLAG
))
!
(
field
->
flags
&
BLOB_FLAG
))
{
{
if
(
outparam
->
file
->
index_flags
(
key
,
i
)
&
HA_KEYREAD_ONLY
)
if
(
outparam
->
file
->
index_flags
(
key
,
i
)
&
HA_KEYREAD_ONLY
)
{
outparam
->
read_only_keys
.
clear_bit
(
key
);
outparam
->
keys_for_keyread
.
set_bit
(
key
);
field
->
part_of_key
.
set_bit
(
key
);
field
->
part_of_key
.
set_bit
(
key
);
}
if
(
outparam
->
file
->
index_flags
(
key
,
i
)
&
HA_READ_ORDER
)
if
(
outparam
->
file
->
index_flags
(
key
,
i
)
&
HA_READ_ORDER
)
field
->
part_of_sortkey
.
set_bit
(
key
);
field
->
part_of_sortkey
.
set_bit
(
key
);
}
}
...
...
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