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
e720c2ce
Commit
e720c2ce
authored
Feb 19, 2004
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sql_select.cc, opt_range.cc, item.cc:
After merge fixes.
parent
d24a2296
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
21 deletions
+24
-21
sql/item.cc
sql/item.cc
+2
-1
sql/opt_range.cc
sql/opt_range.cc
+8
-8
sql/sql_select.cc
sql/sql_select.cc
+14
-12
No files found.
sql/item.cc
View file @
e720c2ce
...
...
@@ -333,7 +333,7 @@ Item_field::Item_field(THD *thd, Item_field *item)
result_field
(
item
->
result_field
)
{
collation
.
set
(
DERIVATION_IMPLICIT
);
item_equal
=
item
.
item_equal
;
item_equal
=
item
->
item_equal
;
}
void
Item_field
::
set_field
(
Field
*
field_par
)
...
...
@@ -1002,6 +1002,7 @@ void Item_field::cleanup()
{
Item_ident
::
cleanup
();
field
=
result_field
=
0
;
}
/*
Find a field among specified multiple equalities
...
...
sql/opt_range.cc
View file @
e720c2ce
...
...
@@ -1530,21 +1530,21 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
switch
(
cond_func
->
functype
())
{
case
Item_func
:
:
NE_FUNC
:
tree
=
get_mm_parts
(
param
,
field
,
Item_func
::
LT_FUNC
,
tree
=
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
LT_FUNC
,
value
,
cmp_type
);
if
(
tree
)
{
tree
=
tree_or
(
param
,
tree
,
get_mm_parts
(
param
,
field
,
tree
=
tree_or
(
param
,
tree
,
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
GT_FUNC
,
value
,
cmp_type
));
}
break
;
case
Item_func
:
:
BETWEEN
:
tree
=
get_mm_parts
(
param
,
field
,
Item_func
::
GE_FUNC
,
tree
=
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
GE_FUNC
,
cond_func
->
arguments
()[
1
],
cmp_type
);
if
(
tree
)
{
tree
=
tree_and
(
param
,
tree
,
get_mm_parts
(
param
,
field
,
tree
=
tree_and
(
param
,
tree
,
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
LE_FUNC
,
cond_func
->
arguments
()[
2
],
cmp_type
));
...
...
@@ -1553,7 +1553,7 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
case
Item_func
:
:
IN_FUNC
:
{
Item_func_in
*
func
=
(
Item_func_in
*
)
cond_func
;
tree
=
get_mm_parts
(
param
,
field
,
Item_func
::
EQ_FUNC
,
tree
=
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
EQ_FUNC
,
func
->
arguments
()[
1
],
cmp_type
);
if
(
tree
)
{
...
...
@@ -1561,7 +1561,7 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
for
(
arg
=
func
->
arguments
()
+
2
,
end
=
arg
+
func
->
argument_count
()
-
2
;
arg
<
end
;
arg
++
)
{
tree
=
tree_or
(
param
,
tree
,
get_mm_parts
(
param
,
field
,
tree
=
tree_or
(
param
,
tree
,
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
EQ_FUNC
,
*
arg
,
cmp_type
));
...
...
@@ -1581,7 +1581,7 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
Item_func
::
Functype
func_type
=
(
value
!=
cond_func
->
arguments
()[
0
])
?
cond_func
->
functype
()
:
((
Item_bool_func2
*
)
cond_func
)
->
rev_functype
();
tree
=
get_mm_parts
(
param
,
field
,
func_type
,
value
,
cmp_type
);
tree
=
get_mm_parts
(
param
,
cond_func
,
field
,
func_type
,
value
,
cmp_type
);
}
}
...
...
@@ -1690,7 +1690,7 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
Item_result
cmp_type
=
field
->
cmp_type
();
if
(
!
((
ref_tables
|
field
->
table
->
map
)
&
param_comp
))
{
tree
=
get_mm_parts
(
param
,
field
,
Item_func
::
EQ_FUNC
,
tree
=
get_mm_parts
(
param
,
cond
,
field
,
Item_func
::
EQ_FUNC
,
value
,
cmp_type
);
ftree
=
!
ftree
?
tree
:
tree_and
(
param
,
ftree
,
tree
);
}
...
...
sql/sql_select.cc
View file @
e720c2ce
...
...
@@ -2190,6 +2190,7 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
add_key_field()
key_fields Pointer to add key, if usable
and_level And level, to be stored in KEY_FIELD
cond Condition predicate
field Field used in comparision
eq_func True if we used =, <=> or IS NULL
value Value used for comparison with field
...
...
@@ -2205,8 +2206,8 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
*/
static
void
add_key_field
(
KEY_FIELD
**
key_fields
,
uint
and_level
,
COND
*
cond
,
Field
*
field
,
bool
eq_func
,
Item
**
value
,
uint
num_values
,
add_key_field
(
KEY_FIELD
**
key_fields
,
uint
and_level
,
COND
*
cond
,
Field
*
field
,
bool
eq_func
,
Item
**
value
,
uint
num_values
,
table_map
usable_tables
)
{
uint
exists_optimize
=
0
;
...
...
@@ -2305,9 +2306,10 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, COND *cond,
Add possible keys to array of possible keys originated from a simple predicate
SYNPOSIS
add_key_equal_field()
add_key_equal_field
s
()
key_fields Pointer to add key, if usable
and_level And level, to be stored in KEY_FIELD
cond Condition predicate
field Field used in comparision
eq_func True if we used =, <=> or IS NULL
value Value used for comparison with field
...
...
@@ -2324,12 +2326,12 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, COND *cond,
static
void
add_key_equal_fields
(
KEY_FIELD
**
key_fields
,
uint
and_level
,
Item_field
*
field_item
,
COND
*
cond
,
Item_field
*
field_item
,
bool
eq_func
,
Item
**
val
,
uint
num_values
,
table_map
usable_tables
)
{
Field
*
field
=
field_item
->
field
;
add_key_field
(
key_fields
,
and_level
,
field
,
add_key_field
(
key_fields
,
and_level
,
cond
,
field
,
eq_func
,
val
,
num_values
,
usable_tables
);
Item_equal
*
item_equal
=
field_item
->
item_equal
;
if
(
item_equal
)
...
...
@@ -2344,7 +2346,7 @@ add_key_equal_fields(KEY_FIELD **key_fields, uint and_level,
{
if
(
!
field
->
eq
(
item
->
field
))
{
add_key_field
(
key_fields
,
and_level
,
item
->
field
,
add_key_field
(
key_fields
,
and_level
,
cond
,
item
->
field
,
eq_func
,
val
,
num_values
,
usable_tables
);
}
}
...
...
@@ -2396,7 +2398,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
// BETWEEN or IN
if
(
cond_func
->
key_item
()
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
&&
!
(
cond_func
->
used_tables
()
&
OUTER_REF_TABLE_BIT
))
add_key_equal_fields
(
key_fields
,
*
and_level
,
add_key_equal_fields
(
key_fields
,
*
and_level
,
cond_func
,
(
Item_field
*
)
(
cond_func
->
key_item
()
->
real_item
()),
0
,
cond_func
->
arguments
()
+
1
,
cond_func
->
argument_count
()
-
1
,
...
...
@@ -2410,7 +2412,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
if
(
cond_func
->
arguments
()[
0
]
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
&&
!
(
cond_func
->
arguments
()[
0
]
->
used_tables
()
&
OUTER_REF_TABLE_BIT
))
{
add_key_equal_fields
(
key_fields
,
*
and_level
,
add_key_equal_fields
(
key_fields
,
*
and_level
,
cond_func
,
(
Item_field
*
)
(
cond_func
->
arguments
()[
0
])
->
real_item
(),
equal_func
,
cond_func
->
arguments
()
+
1
,
1
,
usable_tables
);
...
...
@@ -2419,7 +2421,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
cond_func
->
functype
()
!=
Item_func
::
LIKE_FUNC
&&
!
(
cond_func
->
arguments
()[
1
]
->
used_tables
()
&
OUTER_REF_TABLE_BIT
))
{
add_key_equal_fields
(
key_fields
,
*
and_level
,
add_key_equal_fields
(
key_fields
,
*
and_level
,
cond_func
,
(
Item_field
*
)
(
cond_func
->
arguments
()[
1
])
->
real_item
(),
equal_func
,
cond_func
->
arguments
(),
1
,
usable_tables
);
...
...
@@ -2434,7 +2436,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
Item
*
tmp
=
new
Item_null
;
if
(
!
tmp
)
// Should never be true
return
;
add_key_equal_fields
(
key_fields
,
*
and_level
,
add_key_equal_fields
(
key_fields
,
*
and_level
,
cond_func
,
(
Item_field
*
)
(
cond_func
->
arguments
()[
0
])
->
real_item
(),
cond_func
->
functype
()
==
Item_func
::
ISNULL_FUNC
,
&
tmp
,
1
,
usable_tables
);
...
...
@@ -2454,7 +2456,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
*/
while
((
item
=
it
++
))
{
add_key_field
(
key_fields
,
*
and_level
,
item
->
field
,
add_key_field
(
key_fields
,
*
and_level
,
cond
,
item
->
field
,
TRUE
,
&
const_item
,
1
,
usable_tables
);
}
}
...
...
@@ -2474,7 +2476,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
{
if
(
!
field
->
eq
(
item
->
field
))
{
add_key_field
(
key_fields
,
*
and_level
,
field
,
add_key_field
(
key_fields
,
*
and_level
,
cond
,
field
,
TRUE
,
(
Item
**
)
&
item
,
1
,
usable_tables
);
}
}
...
...
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