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
6e05aabb
Commit
6e05aabb
authored
Aug 16, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: case SQLCOM_CALL
move SP invocation code out of the huge switch in mysql_execute_command
parent
3d9aa6c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
49 deletions
+50
-49
sql/sql_parse.cc
sql/sql_parse.cc
+50
-49
No files found.
sql/sql_parse.cc
View file @
6e05aabb
...
...
@@ -2367,6 +2367,54 @@ err:
}
static
bool
do_execute_sp
(
THD
*
thd
,
sp_head
*
sp
)
{
/* bits that should be cleared in thd->server_status */
uint
bits_to_be_cleared
=
0
;
if
(
sp
->
m_flags
&
sp_head
::
MULTI_RESULTS
)
{
if
(
!
(
thd
->
client_capabilities
&
CLIENT_MULTI_RESULTS
))
{
/* The client does not support multiple result sets being sent back */
my_error
(
ER_SP_BADSELECT
,
MYF
(
0
),
sp
->
m_qname
.
str
);
return
1
;
}
/*
If SERVER_MORE_RESULTS_EXISTS is not set,
then remember that it should be cleared
*/
bits_to_be_cleared
=
(
~
thd
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
);
thd
->
server_status
|=
SERVER_MORE_RESULTS_EXISTS
;
}
ha_rows
select_limit
=
thd
->
variables
.
select_limit
;
thd
->
variables
.
select_limit
=
HA_POS_ERROR
;
/*
We never write CALL statements into binlog:
- If the mode is non-prelocked, each statement will be logged
separately.
- If the mode is prelocked, the invoking statement will care
about writing into binlog.
So just execute the statement.
*/
int
res
=
sp
->
execute_procedure
(
thd
,
&
thd
->
lex
->
value_list
);
thd
->
variables
.
select_limit
=
select_limit
;
thd
->
server_status
&=
~
bits_to_be_cleared
;
if
(
res
)
{
DBUG_ASSERT
(
thd
->
is_error
()
||
thd
->
killed
);
return
1
;
// Substatement should already have sent error
}
my_ok
(
thd
,
(
thd
->
get_row_count_func
()
<
0
)
?
0
:
thd
->
get_row_count_func
());
return
0
;
}
/**
Execute command saved in thd and lex->sql_command.
...
...
@@ -5009,9 +5057,6 @@ create_sp_error:
}
else
{
ha_rows
select_limit
;
/* bits that should be cleared in thd->server_status */
uint
bits_to_be_cleared
=
0
;
/*
Check that the stored procedure doesn't contain Dynamic SQL
and doesn't return result sets: such stored procedures can't
...
...
@@ -5025,52 +5070,8 @@ create_sp_error:
goto
error
;
}
if
(
sp
->
m_flags
&
sp_head
::
MULTI_RESULTS
)
{
if
(
!
(
thd
->
client_capabilities
&
CLIENT_MULTI_RESULTS
))
{
/*
The client does not support multiple result sets being sent
back
*/
my_error
(
ER_SP_BADSELECT
,
MYF
(
0
),
sp
->
m_qname
.
str
);
goto
error
;
}
/*
If SERVER_MORE_RESULTS_EXISTS is not set,
then remember that it should be cleared
*/
bits_to_be_cleared
=
(
~
thd
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
);
thd
->
server_status
|=
SERVER_MORE_RESULTS_EXISTS
;
}
select_limit
=
thd
->
variables
.
select_limit
;
thd
->
variables
.
select_limit
=
HA_POS_ERROR
;
/*
We never write CALL statements into binlog:
- If the mode is non-prelocked, each statement will be logged
separately.
- If the mode is prelocked, the invoking statement will care
about writing into binlog.
So just execute the statement.
*/
res
=
sp
->
execute_procedure
(
thd
,
&
lex
->
value_list
);
thd
->
variables
.
select_limit
=
select_limit
;
thd
->
server_status
&=
~
bits_to_be_cleared
;
if
(
!
res
)
{
my_ok
(
thd
,
(
thd
->
get_row_count_func
()
<
0
)
?
0
:
thd
->
get_row_count_func
());
}
else
{
DBUG_ASSERT
(
thd
->
is_error
()
||
thd
->
killed
);
goto
error
;
// Substatement should already have sent error
}
if
(
do_execute_sp
(
thd
,
sp
))
goto
error
;
}
break
;
}
...
...
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