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
966cc802
Commit
966cc802
authored
Aug 15, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-13528 Add LEX::sp_body_finalize_{procedure|function}
parent
22c9663d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
38 deletions
+37
-38
sql/sql_lex.cc
sql/sql_lex.cc
+26
-0
sql/sql_lex.h
sql/sql_lex.h
+2
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+5
-18
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+4
-20
No files found.
sql/sql_lex.cc
View file @
966cc802
...
@@ -5853,6 +5853,32 @@ sp_head *LEX::make_sp_head(THD *thd, const sp_name *name,
...
@@ -5853,6 +5853,32 @@ sp_head *LEX::make_sp_head(THD *thd, const sp_name *name,
}
}
bool
LEX
::
sp_body_finalize_procedure
(
THD
*
thd
)
{
if
(
sphead
->
check_unresolved_goto
())
return
true
;
sphead
->
set_stmt_end
(
thd
);
sphead
->
restore_thd_mem_root
(
thd
);
return
false
;
}
bool
LEX
::
sp_body_finalize_function
(
THD
*
thd
)
{
if
(
sphead
->
is_not_allowed_in_function
(
"function"
))
return
true
;
if
(
!
(
sphead
->
m_flags
&
sp_head
::
HAS_RETURN
))
{
my_error
(
ER_SP_NORETURN
,
MYF
(
0
),
ErrConvDQName
(
sphead
).
ptr
());
return
true
;
}
if
(
sp_body_finalize_procedure
(
thd
))
return
true
;
(
void
)
is_native_function_with_warn
(
thd
,
&
sphead
->
m_name
);
return
false
;
}
bool
LEX
::
sp_block_with_exceptions_finalize_declarations
(
THD
*
thd
)
bool
LEX
::
sp_block_with_exceptions_finalize_declarations
(
THD
*
thd
)
{
{
/*
/*
...
...
sql/sql_lex.h
View file @
966cc802
...
@@ -3176,6 +3176,8 @@ struct LEX: public Query_tables_list
...
@@ -3176,6 +3176,8 @@ struct LEX: public Query_tables_list
return
NULL
;
return
NULL
;
return
make_sp_head_no_recursive
(
thd
,
name
,
sph
);
return
make_sp_head_no_recursive
(
thd
,
name
,
sph
);
}
}
bool
sp_body_finalize_function
(
THD
*
);
bool
sp_body_finalize_procedure
(
THD
*
);
bool
call_statement_start
(
THD
*
thd
,
sp_name
*
name
);
bool
call_statement_start
(
THD
*
thd
,
sp_name
*
name
);
bool
call_statement_start
(
THD
*
thd
,
const
LEX_CSTRING
*
name
);
bool
call_statement_start
(
THD
*
thd
,
const
LEX_CSTRING
*
name
);
bool
call_statement_start
(
THD
*
thd
,
const
LEX_CSTRING
*
name1
,
bool
call_statement_start
(
THD
*
thd
,
const
LEX_CSTRING
*
name1
,
...
...
sql/sql_yacc.yy
View file @
966cc802
...
@@ -16615,6 +16615,7 @@ sf_tail:
...
@@ -16615,6 +16615,7 @@ sf_tail:
opt_if_not_exists
opt_if_not_exists
sp_name
sp_name
{
{
Lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
&sp_handler_function))
&sp_handler_function))
MYSQL_YYABORT;
MYSQL_YYABORT;
...
@@ -16631,25 +16632,15 @@ sf_tail:
...
@@ -16631,25 +16632,15 @@ sf_tail:
}
}
sp_proc_stmt_in_returns_clause
sp_proc_stmt_in_returns_clause
{
{
LEX *lex= thd->lex;
if (Lex->sp_body_finalize_function(thd))
sp_head *sp= lex->sphead;
if (sp->is_not_allowed_in_function("function"))
MYSQL_YYABORT;
MYSQL_YYABORT;
lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
sp->set_stmt_end(thd);
if (!(sp->m_flags & sp_head::HAS_RETURN))
my_yyabort_error((ER_SP_NORETURN, MYF(0),
ErrConvDQName(sp).ptr()));
(void) is_native_function_with_warn(thd, &sp->m_name);
sp->restore_thd_mem_root(thd);
}
}
;
;
sp_tail:
sp_tail:
opt_if_not_exists sp_name
opt_if_not_exists sp_name
{
{
Lex->sql_command= SQLCOM_CREATE_PROCEDURE;
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
&sp_handler_procedure))
&sp_handler_procedure))
MYSQL_YYABORT;
MYSQL_YYABORT;
...
@@ -16662,12 +16653,8 @@ sp_tail:
...
@@ -16662,12 +16653,8 @@ sp_tail:
}
}
sp_proc_stmt
sp_proc_stmt
{
{
LEX *lex= Lex;
if (Lex->sp_body_finalize_procedure(thd))
sp_head *sp= lex->sphead;
MYSQL_YYABORT;
sp->set_stmt_end(thd);
lex->sql_command= SQLCOM_CREATE_PROCEDURE;
sp->restore_thd_mem_root(thd);
}
}
;
;
...
...
sql/sql_yacc_ora.yy
View file @
966cc802
...
@@ -16837,6 +16837,7 @@ sf_tail:
...
@@ -16837,6 +16837,7 @@ sf_tail:
opt_if_not_exists
opt_if_not_exists
sp_name
sp_name
{
{
Lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
&sp_handler_function))
&sp_handler_function))
MYSQL_YYABORT;
MYSQL_YYABORT;
...
@@ -16854,27 +16855,15 @@ sf_tail:
...
@@ -16854,27 +16855,15 @@ sf_tail:
sp_tail_is
sp_tail_is
sp_body
sp_body
{
{
LEX *lex= thd->lex;
if (Lex->sp_body_finalize_function(thd))
sp_head *sp= lex->sphead;
if (sp->check_unresolved_goto())
MYSQL_YYABORT;
MYSQL_YYABORT;
if (sp->is_not_allowed_in_function("function"))
MYSQL_YYABORT;
lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
sp->set_stmt_end(thd);
if (!(sp->m_flags & sp_head::HAS_RETURN))
my_yyabort_error((ER_SP_NORETURN, MYF(0),
ErrConvDQName(sp).ptr()));
(void) is_native_function_with_warn(thd, &sp->m_name);
sp->restore_thd_mem_root(thd);
}
}
;
;
sp_tail:
sp_tail:
opt_if_not_exists sp_name
opt_if_not_exists sp_name
{
{
Lex->sql_command= SQLCOM_CREATE_PROCEDURE;
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
&sp_handler_procedure))
&sp_handler_procedure))
MYSQL_YYABORT;
MYSQL_YYABORT;
...
@@ -16888,13 +16877,8 @@ sp_tail:
...
@@ -16888,13 +16877,8 @@ sp_tail:
sp_tail_is
sp_tail_is
sp_body
sp_body
{
{
LEX *lex= Lex;
if (Lex->sp_body_finalize_procedure(thd))
sp_head *sp= lex->sphead;
if (sp->check_unresolved_goto())
MYSQL_YYABORT;
MYSQL_YYABORT;
sp->set_stmt_end(thd);
lex->sql_command= SQLCOM_CREATE_PROCEDURE;
sp->restore_thd_mem_root(thd);
}
}
;
;
...
...
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