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
5cf3dd79
Commit
5cf3dd79
authored
Oct 18, 2016
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: JOIN + WHERE in SP
parent
4c5a2e50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
sql/sql_select.cc
sql/sql_select.cc
+16
-12
No files found.
sql/sql_select.cc
View file @
5cf3dd79
...
...
@@ -681,6 +681,7 @@ setup_for_system_time(THD *thd, TABLE_LIST *tables, COND **where_expr, SELECT_LE
&& !is_prepare
&& !thd->stmt_arena->is_sp_execute())
{
// statement is already prepared
DBUG_RETURN(0);
}
...
...
@@ -716,27 +717,30 @@ setup_for_system_time(THD *thd, TABLE_LIST *tables, COND **where_expr, SELECT_LE
{
if (table->table && table->table->versioned())
{
COND
**
dst_cond
;
if
(
table
->
on_expr
)
COND** dst_cond
= where_expr
;
if (table->
saved_on_expr) // same logic as saved_where
{
if
(
table
->
saved_on_expr
)
// same logic as saved_where
DBUG_ASSERT(thd->stmt_arena->is_sp_execute());
if (table->on_expr)
{
DBUG_ASSERT
(
thd
->
stmt_arena
->
is_sp_execute
());
table->on_expr= table->saved_on_expr;
dst_cond= &table->on_expr;
}
else
if
(
thd
->
stmt_arena
->
is_sp_execute
())
else
{
if
(
thd
->
stmt_arena
->
is_stmt_execute
())
// SP executed second time (STMT_EXECUTED
)
table
->
on_expr
=
0
;
else
if
(
table
->
on_expr
)
// SP executed first time (STMT_INITIALIZED_FOR_SP)
table
->
saved_on_expr
=
table
->
on_expr
->
copy_andor_structure
(
thd
);
// on_expr was moved to WHERE (see below: Add ON expression to the WHERE
)
*dst_cond= and_items(thd,
*where_expr,
table->saved_on_expr);
}
dst_cond
=
&
table
->
on_expr
;
}
else
else
if (table->on_expr)
{
dst_cond
=
where_expr
;
dst_cond= &table->on_expr;
if (thd->stmt_arena->state == Query_arena::STMT_INITIALIZED_FOR_SP)
table->saved_on_expr= table->on_expr->copy_andor_structure(thd);
}
Field *fstart= table->table->vers_start_field();
Field *fend= table->table->vers_end_field();
...
...
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