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
e399949b
Commit
e399949b
authored
Aug 09, 2016
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding Lex_spblock_st::init() and Lex_spblock_st::join().
parent
365e0b31
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
19 deletions
+34
-19
sql/sql_lex.h
sql/sql_lex.h
+17
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-9
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+3
-9
sql/structs.h
sql/structs.h
+11
-0
No files found.
sql/sql_lex.h
View file @
e399949b
...
@@ -3092,7 +3092,6 @@ struct LEX: public Query_tables_list
...
@@ -3092,7 +3092,6 @@ struct LEX: public Query_tables_list
// Unlabeled blocks get an empty label
// Unlabeled blocks get an empty label
sp_block_init
(
thd
,
empty_lex_str
);
sp_block_init
(
thd
,
empty_lex_str
);
}
}
public:
bool
sp_block_finalize
(
THD
*
thd
,
const
Lex_spblock_st
spblock
)
bool
sp_block_finalize
(
THD
*
thd
,
const
Lex_spblock_st
spblock
)
{
{
class
sp_label
*
tmp
;
class
sp_label
*
tmp
;
...
@@ -3100,6 +3099,23 @@ struct LEX: public Query_tables_list
...
@@ -3100,6 +3099,23 @@ struct LEX: public Query_tables_list
}
}
bool
sp_block_finalize
(
THD
*
thd
,
const
Lex_spblock_st
spblock
,
bool
sp_block_finalize
(
THD
*
thd
,
const
Lex_spblock_st
spblock
,
const
LEX_STRING
end_label
);
const
LEX_STRING
end_label
);
bool
sp_declarations_join
(
Lex_spblock_st
*
res
,
const
Lex_spblock_st
b1
,
const
Lex_spblock_st
b2
)
const
{
if
((
b2
.
vars
||
b2
.
conds
)
&&
(
b1
.
curs
||
b1
.
hndlrs
))
{
my_error
(
ER_SP_VARCOND_AFTER_CURSHNDLR
,
MYF
(
0
));
return
true
;
}
if
(
b2
.
curs
&&
b1
.
hndlrs
)
{
my_error
(
ER_SP_CURSOR_AFTER_HANDLER
,
MYF
(
0
));
return
true
;
}
res
->
join
(
b1
,
b2
);
return
false
;
}
// Check if "KEY IF NOT EXISTS name" used outside of ALTER context
// Check if "KEY IF NOT EXISTS name" used outside of ALTER context
bool
check_add_key
(
DDL_options_st
ddl
)
bool
check_add_key
(
DDL_options_st
ddl
)
{
{
...
...
sql/sql_yacc.yy
View file @
e399949b
...
@@ -2976,7 +2976,7 @@ sp_proc_stmts1:
...
@@ -2976,7 +2976,7 @@ sp_proc_stmts1:
sp_decls:
sp_decls:
/* Empty */
/* Empty */
{
{
$$.
vars= $$.conds= $$.hndlrs= $$.curs= 0
;
$$.
init()
;
}
}
| sp_decls sp_decl ';'
| sp_decls sp_decl ';'
{
{
...
@@ -2984,14 +2984,8 @@ sp_decls:
...
@@ -2984,14 +2984,8 @@ sp_decls:
because letting the grammar rules reflect it caused tricky
because letting the grammar rules reflect it caused tricky
shift/reduce conflicts with the wrong result. (And we get
shift/reduce conflicts with the wrong result. (And we get
better error handling this way.) */
better error handling this way.) */
if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
if (Lex->sp_declarations_join(&$$, $1, $2))
my_yyabort_error((ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0)));
MYSQL_YYABORT;
if ($2.curs && $1.hndlrs)
my_yyabort_error((ER_SP_CURSOR_AFTER_HANDLER, MYF(0)));
$$.vars= $1.vars + $2.vars;
$$.conds= $1.conds + $2.conds;
$$.hndlrs= $1.hndlrs + $2.hndlrs;
$$.curs= $1.curs + $2.curs;
}
}
;
;
...
...
sql/sql_yacc_ora.yy
View file @
e399949b
...
@@ -2362,7 +2362,7 @@ sp_proc_stmts1:
...
@@ -2362,7 +2362,7 @@ sp_proc_stmts1:
sp_decls:
sp_decls:
/* Empty */
/* Empty */
{
{
$$.
vars= $$.conds= $$.hndlrs= $$.curs= 0
;
$$.
init()
;
}
}
| sp_decls sp_decl ';'
| sp_decls sp_decl ';'
{
{
...
@@ -2370,14 +2370,8 @@ sp_decls:
...
@@ -2370,14 +2370,8 @@ sp_decls:
because letting the grammar rules reflect it caused tricky
because letting the grammar rules reflect it caused tricky
shift/reduce conflicts with the wrong result. (And we get
shift/reduce conflicts with the wrong result. (And we get
better error handling this way.) */
better error handling this way.) */
if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
if (Lex->sp_declarations_join(&$$, $1, $2))
my_yyabort_error((ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0)));
MYSQL_YYABORT;
if ($2.curs && $1.hndlrs)
my_yyabort_error((ER_SP_CURSOR_AFTER_HANDLER, MYF(0)));
$$.vars= $1.vars + $2.vars;
$$.conds= $1.conds + $2.conds;
$$.hndlrs= $1.hndlrs + $2.hndlrs;
$$.curs= $1.curs + $2.curs;
}
}
;
;
...
...
sql/structs.h
View file @
e399949b
...
@@ -635,6 +635,17 @@ struct Lex_spblock_st
...
@@ -635,6 +635,17 @@ struct Lex_spblock_st
int
conds
;
int
conds
;
int
hndlrs
;
int
hndlrs
;
int
curs
;
int
curs
;
void
init
()
{
vars
=
conds
=
hndlrs
=
curs
=
0
;
}
void
join
(
const
Lex_spblock_st
&
b1
,
const
Lex_spblock_st
&
b2
)
{
vars
=
b1
.
vars
+
b2
.
vars
;
conds
=
b1
.
conds
+
b2
.
conds
;
hndlrs
=
b1
.
hndlrs
+
b2
.
hndlrs
;
curs
=
b1
.
curs
+
b2
.
curs
;
}
};
};
...
...
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