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
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
Hide 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)
...
@@ -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
// it is primary INSERT st_select_lex => skip first table resolving
table_list
=
table_list
->
next
;
table_list
=
table_list
->
next
;
}
}
Item_subselect
*
prev_subselect_item
=
prev_unit
->
item
;
if
((
tmp
=
find_field_in_tables
(
thd
,
this
,
if
((
tmp
=
find_field_in_tables
(
thd
,
this
,
table_list
,
&
where
,
table_list
,
&
where
,
0
))
!=
not_found_field
)
0
))
!=
not_found_field
)
{
{
prev_
unit
->
item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_
subselect_
item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_
unit
->
item
->
const_item_cache
=
0
;
prev_
subselect_
item
->
const_item_cache
=
0
;
break
;
break
;
}
}
if
(
sl
->
resolve_mode
==
SELECT_LEX
::
SELECT_MODE
&&
if
(
sl
->
resolve_mode
==
SELECT_LEX
::
SELECT_MODE
&&
...
@@ -844,15 +846,15 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -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
if
(
*
refer
&&
(
*
refer
)
->
fixed
)
// Avoid crash in case of error
{
{
prev_
unit
->
item
->
used_tables_cache
|=
(
*
refer
)
->
used_tables
();
prev_
subselect_
item
->
used_tables_cache
|=
(
*
refer
)
->
used_tables
();
prev_
unit
->
item
->
const_item_cache
&=
(
*
refer
)
->
const_item
();
prev_
subselect_
item
->
const_item_cache
&=
(
*
refer
)
->
const_item
();
}
}
break
;
break
;
}
}
// Reference is not found => depend from outer (or just error)
// Reference is not found => depend from outer (or just error)
prev_
unit
->
item
->
used_tables_cache
|=
OUTER_REF_TABLE_BIT
;
prev_
subselect_
item
->
used_tables_cache
|=
OUTER_REF_TABLE_BIT
;
prev_
unit
->
item
->
const_item_cache
=
0
;
prev_
subselect_
item
->
const_item_cache
=
0
;
if
(
sl
->
master_unit
()
->
first_select
()
->
linkage
==
if
(
sl
->
master_unit
()
->
first_select
()
->
linkage
==
DERIVED_TABLE_TYPE
)
DERIVED_TABLE_TYPE
)
...
@@ -1401,6 +1403,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
...
@@ -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
())
for
(
;
sl
;
sl
=
(
prev_unit
=
sl
->
master_unit
())
->
outer_select
())
{
{
last
=
sl
;
last
=
sl
;
Item_subselect
*
prev_subselect_item
=
prev_unit
->
item
;
if
(
sl
->
resolve_mode
==
SELECT_LEX
::
SELECT_MODE
&&
if
(
sl
->
resolve_mode
==
SELECT_LEX
::
SELECT_MODE
&&
(
ref
=
find_item_in_list
(
this
,
sl
->
item_list
,
(
ref
=
find_item_in_list
(
this
,
sl
->
item_list
,
&
counter
,
&
counter
,
...
@@ -1409,8 +1412,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
...
@@ -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
if
(
*
ref
&&
(
*
ref
)
->
fixed
)
// Avoid crash in case of error
{
{
prev_
unit
->
item
->
used_tables_cache
|=
(
*
ref
)
->
used_tables
();
prev_
subselect_
item
->
used_tables_cache
|=
(
*
ref
)
->
used_tables
();
prev_
unit
->
item
->
const_item_cache
&=
(
*
ref
)
->
const_item
();
prev_
subselect_
item
->
const_item_cache
&=
(
*
ref
)
->
const_item
();
}
}
break
;
break
;
}
}
...
@@ -1424,14 +1427,14 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
...
@@ -1424,14 +1427,14 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
table_list
,
&
where
,
table_list
,
&
where
,
0
))
!=
not_found_field
)
0
))
!=
not_found_field
)
{
{
prev_
unit
->
item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_
subselect_
item
->
used_tables_cache
|=
tmp
->
table
->
map
;
prev_
unit
->
item
->
const_item_cache
=
0
;
prev_
subselect_
item
->
const_item_cache
=
0
;
break
;
break
;
}
}
// Reference is not found => depend from outer (or just error)
// Reference is not found => depend from outer (or just error)
prev_
unit
->
item
->
used_tables_cache
|=
OUTER_REF_TABLE_BIT
;
prev_
subselect_
item
->
used_tables_cache
|=
OUTER_REF_TABLE_BIT
;
prev_
unit
->
item
->
const_item_cache
=
0
;
prev_
subselect_
item
->
const_item_cache
=
0
;
if
(
sl
->
master_unit
()
->
first_select
()
->
linkage
==
if
(
sl
->
master_unit
()
->
first_select
()
->
linkage
==
DERIVED_TABLE_TYPE
)
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)
...
@@ -112,6 +112,11 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
}
}
fix_length_and_dec
();
fix_length_and_dec
();
}
}
if
(
engine
->
uncacheable
())
{
const_item_cache
=
0
;
used_tables_cache
|=
RAND_TABLE_BIT
;
}
fixed
=
1
;
fixed
=
1
;
thd
->
where
=
save_where
;
thd
->
where
=
save_where
;
return
res
;
return
res
;
...
@@ -149,13 +154,12 @@ void Item_subselect::fix_length_and_dec()
...
@@ -149,13 +154,12 @@ void Item_subselect::fix_length_and_dec()
table_map
Item_subselect
::
used_tables
()
const
table_map
Item_subselect
::
used_tables
()
const
{
{
return
(
table_map
)
(
engine
->
dependent
()
?
used_tables_cache
:
return
(
table_map
)
(
engine
->
dependent
()
?
used_tables_cache
:
0L
);
(
engine
->
uncacheable
()
?
RAND_TABLE_BIT
:
0L
));
}
}
bool
Item_subselect
::
const_item
()
const
bool
Item_subselect
::
const_item
()
const
{
{
return
engine
->
uncacheable
()
?
0
:
const_item_cache
;
return
const_item_cache
;
}
}
void
Item_subselect
::
update_used_tables
()
void
Item_subselect
::
update_used_tables
()
...
@@ -163,7 +167,7 @@ void Item_subselect::update_used_tables()
...
@@ -163,7 +167,7 @@ void Item_subselect::update_used_tables()
if
(
!
engine
->
uncacheable
())
if
(
!
engine
->
uncacheable
())
{
{
// did all used tables become ststic?
// 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
;
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