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
90ced854
Commit
90ced854
authored
Jun 06, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent needless rexecuting empty subselects
parent
4a1dec3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
sql/item_subselect.cc
sql/item_subselect.cc
+3
-2
sql/item_subselect.h
sql/item_subselect.h
+2
-0
sql/sql_class.cc
sql/sql_class.cc
+2
-2
No files found.
sql/item_subselect.cc
View file @
90ced854
...
@@ -36,7 +36,7 @@ SUBSELECT TODO:
...
@@ -36,7 +36,7 @@ SUBSELECT TODO:
#include "sql_select.h"
#include "sql_select.h"
Item_subselect
::
Item_subselect
(
THD
*
thd
,
st_select_lex
*
select_lex
)
:
Item_subselect
::
Item_subselect
(
THD
*
thd
,
st_select_lex
*
select_lex
)
:
executed
(
0
),
optimized
(
0
),
error
(
0
)
assigned
(
0
),
executed
(
0
),
optimized
(
0
),
error
(
0
)
{
{
DBUG_ENTER
(
"Item_subselect::Item_subselect"
);
DBUG_ENTER
(
"Item_subselect::Item_subselect"
);
DBUG_PRINT
(
"subs"
,
(
"select_lex 0x%xl"
,
(
long
)
select_lex
));
DBUG_PRINT
(
"subs"
,
(
"select_lex 0x%xl"
,
(
long
)
select_lex
));
...
@@ -141,7 +141,7 @@ int Item_subselect::exec()
...
@@ -141,7 +141,7 @@ int Item_subselect::exec()
return
1
;
return
1
;
}
}
assign_null
();
assign_null
();
executed
=
0
;
executed
=
assigned
=
0
;
}
}
if
(
!
executed
)
if
(
!
executed
)
{
{
...
@@ -149,6 +149,7 @@ int Item_subselect::exec()
...
@@ -149,6 +149,7 @@ int Item_subselect::exec()
join
->
thd
->
lex
.
select
=
select_lex
;
join
->
thd
->
lex
.
select
=
select_lex
;
join
->
exec
();
join
->
exec
();
join
->
thd
->
lex
.
select
=
save_select
;
join
->
thd
->
lex
.
select
=
save_select
;
executed
=
1
;
return
join
->
error
;
return
join
->
error
;
}
}
return
0
;
return
0
;
...
...
sql/item_subselect.h
View file @
90ced854
...
@@ -31,6 +31,7 @@ class Item_subselect :public Item
...
@@ -31,6 +31,7 @@ class Item_subselect :public Item
protected:
protected:
longlong
int_value
;
longlong
int_value
;
double
real_value
;
double
real_value
;
my_bool
assigned
;
/* value already assigned to subselect */
my_bool
executed
;
/* simple subselect is executed */
my_bool
executed
;
/* simple subselect is executed */
my_bool
optimized
;
/* simple subselect is optimized */
my_bool
optimized
;
/* simple subselect is optimized */
my_bool
error
;
/* error in query */
my_bool
error
;
/* error in query */
...
@@ -59,6 +60,7 @@ public:
...
@@ -59,6 +60,7 @@ public:
max_length
=
item
->
max_length
;
max_length
=
item
->
max_length
;
decimals
=
item
->
decimals
;
decimals
=
item
->
decimals
;
res_type
=
item
->
res_type
;
res_type
=
item
->
res_type
;
assigned
=
item
->
assigned
;
executed
=
item
->
executed
;
executed
=
item
->
executed
;
select_lex
=
item
->
select_lex
;
select_lex
=
item
->
select_lex
;
join
=
item
->
join
;
join
=
item
->
join
;
...
...
sql/sql_class.cc
View file @
90ced854
...
@@ -785,7 +785,7 @@ select_subselect::select_subselect(Item_subselect *item)
...
@@ -785,7 +785,7 @@ select_subselect::select_subselect(Item_subselect *item)
bool
select_subselect
::
send_data
(
List
<
Item
>
&
items
)
bool
select_subselect
::
send_data
(
List
<
Item
>
&
items
)
{
{
DBUG_ENTER
(
"select_subselect::send_data"
);
DBUG_ENTER
(
"select_subselect::send_data"
);
if
(
item
->
execut
ed
){
if
(
item
->
assign
ed
){
my_printf_error
(
ER_SUBSELECT_NO_1_ROW
,
ER
(
ER_SUBSELECT_NO_1_ROW
),
MYF
(
0
));
my_printf_error
(
ER_SUBSELECT_NO_1_ROW
,
ER
(
ER_SUBSELECT_NO_1_ROW
),
MYF
(
0
));
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
...
@@ -812,6 +812,6 @@ bool select_subselect::send_data(List<Item> &items)
...
@@ -812,6 +812,6 @@ bool select_subselect::send_data(List<Item> &items)
item
->
int_value
=
val_item
->
val_int
();
item
->
int_value
=
val_item
->
val_int
();
item
->
res_type
=
val_item
->
result_type
();
item
->
res_type
=
val_item
->
result_type
();
}
}
item
->
execut
ed
=
1
;
item
->
assign
ed
=
1
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
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