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
b0bd7f80
Commit
b0bd7f80
authored
Oct 23, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ufter review fix (BUG#1444)
parent
b9dccb34
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
+23
-16
sql/item.cc
sql/item.cc
+15
-12
sql/item_subselect.cc
sql/item_subselect.cc
+8
-4
No files found.
sql/item.cc
View file @
b0bd7f80
...
...
@@ -829,12 +829,14 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
// it is primary INSERT st_select_lex => skip first table resolving
table_list
=
table_list
->
next
;
}
Item_subselect
*
prev_subselect_item
=
prev_unit
->
item
;
if
((
tmp
=
find_field_in_tables
(
thd
,
this
,
table_list
,
&
where
,
0
))
!=
not_found_field
)
{
prev_
unit
->
item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_
unit
->
item
->
const_item_cache
=
0
;
prev_
subselect_
item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_
subselect_
item
->
const_item_cache
=
0
;
break
;
}
if
(
sl
->
resolve_mode
==
SELECT_LEX
::
SELECT_MODE
&&
...
...
@@ -844,15 +846,15 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
if
(
*
refer
&&
(
*
refer
)
->
fixed
)
// Avoid crash in case of error
{
prev_
unit
->
item
->
used_tables_cache
|=
(
*
refer
)
->
used_tables
();
prev_
unit
->
item
->
const_item_cache
&=
(
*
refer
)
->
const_item
();
prev_
subselect_
item
->
used_tables_cache
|=
(
*
refer
)
->
used_tables
();
prev_
subselect_
item
->
const_item_cache
&=
(
*
refer
)
->
const_item
();
}
break
;
}
// Reference is not found => depend from outer (or just error)
prev_
unit
->
item
->
used_tables_cache
|=
OUTER_REF_TABLE_BIT
;
prev_
unit
->
item
->
const_item_cache
=
0
;
prev_
subselect_
item
->
used_tables_cache
|=
OUTER_REF_TABLE_BIT
;
prev_
subselect_
item
->
const_item_cache
=
0
;
if
(
sl
->
master_unit
()
->
first_select
()
->
linkage
==
DERIVED_TABLE_TYPE
)
...
...
@@ -1401,6 +1403,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
for
(
;
sl
;
sl
=
(
prev_unit
=
sl
->
master_unit
())
->
outer_select
())
{
last
=
sl
;
Item_subselect
*
prev_subselect_item
=
prev_unit
->
item
;
if
(
sl
->
resolve_mode
==
SELECT_LEX
::
SELECT_MODE
&&
(
ref
=
find_item_in_list
(
this
,
sl
->
item_list
,
&
counter
,
...
...
@@ -1409,8 +1412,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{
if
(
*
ref
&&
(
*
ref
)
->
fixed
)
// Avoid crash in case of error
{
prev_
unit
->
item
->
used_tables_cache
|=
(
*
ref
)
->
used_tables
();
prev_
unit
->
item
->
const_item_cache
&=
(
*
ref
)
->
const_item
();
prev_
subselect_
item
->
used_tables_cache
|=
(
*
ref
)
->
used_tables
();
prev_
subselect_
item
->
const_item_cache
&=
(
*
ref
)
->
const_item
();
}
break
;
}
...
...
@@ -1424,14 +1427,14 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
table_list
,
&
where
,
0
))
!=
not_found_field
)
{
prev_
unit
->
item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_
unit
->
item
->
const_item_cache
=
0
;
prev_
subselect_
item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_
subselect_
item
->
const_item_cache
=
0
;
break
;
}
// Reference is not found => depend from outer (or just error)
prev_
unit
->
item
->
used_tables_cache
|=
OUTER_REF_TABLE_BIT
;
prev_
unit
->
item
->
const_item_cache
=
0
;
prev_
subselect_
item
->
used_tables_cache
|=
OUTER_REF_TABLE_BIT
;
prev_
subselect_
item
->
const_item_cache
=
0
;
if
(
sl
->
master_unit
()
->
first_select
()
->
linkage
==
DERIVED_TABLE_TYPE
)
...
...
sql/item_subselect.cc
View file @
b0bd7f80
...
...
@@ -112,6 +112,11 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
}
fix_length_and_dec
();
}
if
(
engine
->
uncacheable
())
{
const_item_cache
=
0
;
used_tables_cache
|=
RAND_TABLE_BIT
;
}
fixed
=
1
;
thd
->
where
=
save_where
;
return
res
;
...
...
@@ -149,13 +154,12 @@ void Item_subselect::fix_length_and_dec()
table_map
Item_subselect
::
used_tables
()
const
{
return
(
table_map
)
(
engine
->
dependent
()
?
used_tables_cache
:
(
engine
->
uncacheable
()
?
RAND_TABLE_BIT
:
0L
));
return
(
table_map
)
(
engine
->
dependent
()
?
used_tables_cache
:
0L
);
}
bool
Item_subselect
::
const_item
()
const
{
return
engine
->
uncacheable
()
?
0
:
const_item_cache
;
return
const_item_cache
;
}
void
Item_subselect
::
update_used_tables
()
...
...
@@ -163,7 +167,7 @@ void Item_subselect::update_used_tables()
if
(
!
engine
->
uncacheable
())
{
// did all used tables become ststic?
if
((
used_tables_cache
&
~
engine
->
upper_select_const_tables
())
==
0
)
if
((
used_tables_cache
&
~
engine
->
upper_select_const_tables
()))
const_item_cache
=
1
;
}
}
...
...
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