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
9372f6e5
Commit
9372f6e5
authored
Aug 01, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-13419 Cleanup for Sp_handler::show_create_sp
parent
c9218ff4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
28 deletions
+36
-28
sql/sp.cc
sql/sp.cc
+22
-21
sql/sp.h
sql/sp.h
+6
-0
sql/wsrep_mysqld.cc
sql/wsrep_mysqld.cc
+8
-7
No files found.
sql/sp.cc
View file @
9372f6e5
...
...
@@ -862,8 +862,6 @@ Sp_handler::db_load_routine(THD *thd, const Database_qualified_name *name,
thd
->
lex
=
&
newlex
;
newlex
.
current_select
=
NULL
;
// Resetting REPLACE and EXIST flags in create_info, for show_create_sp()
newlex
.
create_info
.
DDL_options_st
::
init
();
defstr
.
set_charset
(
creation_ctx
->
get_client_cs
());
...
...
@@ -873,10 +871,10 @@ Sp_handler::db_load_routine(THD *thd, const Database_qualified_name *name,
definition for SHOW CREATE PROCEDURE later.
*/
if
(
!
show_create_sp
(
thd
,
&
defstr
,
null_clex_str
,
name
->
m_name
,
params
,
returns
,
body
,
chistics
,
definer
,
sql_mode
))
if
(
show_create_sp
(
thd
,
&
defstr
,
null_clex_str
,
name
->
m_name
,
params
,
returns
,
body
,
chistics
,
definer
,
DDL_options
()
,
sql_mode
))
{
ret
=
SP_INTERNAL_ERROR
;
goto
end
;
...
...
@@ -1303,12 +1301,14 @@ Sp_handler::sp_create_routine(THD *thd, const sp_head *sp) const
String
log_query
;
log_query
.
set_charset
(
system_charset_info
);
if
(
!
show_create_sp
(
thd
,
&
log_query
,
sp
->
m_explicit_name
?
sp
->
m_db
:
null_clex_str
,
sp
->
m_name
,
sp
->
m_params
,
returns
,
sp
->
m_body
,
sp
->
chistics
(),
thd
->
lex
->
definer
[
0
],
saved_mode
))
if
(
show_create_sp
(
thd
,
&
log_query
,
sp
->
m_explicit_name
?
sp
->
m_db
:
null_clex_str
,
sp
->
m_name
,
sp
->
m_params
,
returns
,
sp
->
m_body
,
sp
->
chistics
(),
thd
->
lex
->
definer
[
0
],
thd
->
lex
->
create_info
,
saved_mode
))
{
my_error
(
ER_OUT_OF_RESOURCES
,
MYF
(
0
));
goto
done
;
...
...
@@ -2176,7 +2176,7 @@ int Sp_handler::sp_cache_routine(THD *thd,
Generates the CREATE... string from the table information.
@return
Returns
TRUE on success, FALSE
on (alloc) failure.
Returns
false on success, true
on (alloc) failure.
*/
bool
Sp_handler
::
show_create_sp
(
THD
*
thd
,
String
*
buf
,
...
...
@@ -2187,6 +2187,7 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
const
LEX_CSTRING
&
body
,
const
st_sp_chistics
&
chistics
,
const
AUTHID
&
definer
,
const
DDL_options_st
ddl_options
,
sql_mode_t
sql_mode
)
const
{
sql_mode_t
old_sql_mode
=
thd
->
variables
.
sql_mode
;
...
...
@@ -2195,16 +2196,16 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
params
.
length
+
returns
.
length
+
chistics
.
comment
.
length
+
10
/* length of " DEFINER= "*/
+
USER_HOST_BUFF_SIZE
))
return
FALSE
;
return
true
;
thd
->
variables
.
sql_mode
=
sql_mode
;
buf
->
append
(
STRING_WITH_LEN
(
"CREATE "
));
if
(
thd
->
lex
->
create_info
.
or_replace
())
if
(
ddl_options
.
or_replace
())
buf
->
append
(
STRING_WITH_LEN
(
"OR REPLACE "
));
append_definer
(
thd
,
buf
,
&
definer
.
user
,
&
definer
.
host
);
buf
->
append
(
type_lex_cstring
());
buf
->
append
(
STRING_WITH_LEN
(
" "
));
if
(
thd
->
lex
->
create_info
.
if_not_exists
())
if
(
ddl_options
.
if_not_exists
())
buf
->
append
(
STRING_WITH_LEN
(
"IF NOT EXISTS "
));
if
(
db
.
length
>
0
)
...
...
@@ -2252,7 +2253,7 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
}
buf
->
append
(
body
);
thd
->
variables
.
sql_mode
=
old_sql_mode
;
return
TRUE
;
return
false
;
}
...
...
@@ -2300,10 +2301,10 @@ Sp_handler::sp_load_for_information_schema(THD *thd, TABLE *proc_table,
Stored_program_creation_ctx
*
creation_ctx
=
Stored_routine_creation_ctx
::
load_from_db
(
thd
,
&
sp_name_obj
,
proc_table
);
defstr
.
set_charset
(
creation_ctx
->
get_client_cs
());
if
(
!
show_create_sp
(
thd
,
&
defstr
,
sp_name_obj
.
m_db
,
sp_name_obj
.
m_name
,
params
,
returns
,
empty_body_lex_cstring
(),
Sp_chistics
(),
definer
,
sql_mode
))
if
(
show_create_sp
(
thd
,
&
defstr
,
sp_name_obj
.
m_db
,
sp_name_obj
.
m_name
,
params
,
returns
,
empty_body_lex_cstring
(),
Sp_chistics
(),
definer
,
DDL_options
()
,
sql_mode
))
return
0
;
thd
->
lex
=
&
newlex
;
...
...
sql/sp.h
View file @
9372f6e5
...
...
@@ -150,6 +150,11 @@ class Sp_handler
sql_mode_t
sql_mode
,
bool
*
free_sp_head
)
const
;
/*
Make a SHOW CREATE statement.
@retval true on error
@retval false on success
*/
bool
show_create_sp
(
THD
*
thd
,
String
*
buf
,
const
LEX_CSTRING
&
db
,
const
LEX_CSTRING
&
name
,
...
...
@@ -158,6 +163,7 @@ class Sp_handler
const
LEX_CSTRING
&
body
,
const
st_sp_chistics
&
chistics
,
const
AUTHID
&
definer
,
const
DDL_options_st
ddl_options
,
sql_mode_t
sql_mode
)
const
;
};
...
...
sql/wsrep_mysqld.cc
View file @
9372f6e5
...
...
@@ -2246,13 +2246,14 @@ static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
sp_returns_type
(
thd
,
retstr
,
sp
);
returns
=
retstr
.
lex_cstring
();
}
if
(
!
sp
->
m_handler
->
show_create_sp
(
thd
,
&
log_query
,
sp
->
m_explicit_name
?
sp
->
m_db
:
null_clex_str
,
sp
->
m_name
,
sp
->
m_params
,
returns
,
sp
->
m_body
,
sp
->
chistics
(),
thd
->
lex
->
definer
[
0
],
saved_mode
))
if
(
sp
->
m_handler
->
show_create_sp
(
thd
,
&
log_query
,
sp
->
m_explicit_name
?
sp
->
m_db
:
null_clex_str
,
sp
->
m_name
,
sp
->
m_params
,
returns
,
sp
->
m_body
,
sp
->
chistics
(),
thd
->
lex
->
definer
[
0
],
thd
->
lex
->
create_info
,
saved_mode
))
{
WSREP_WARN
(
"SP create string failed: schema: %s, query: %s"
,
(
thd
->
db
?
thd
->
db
:
"(null)"
),
thd
->
query
());
...
...
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