summaryrefslogtreecommitdiff
path: root/sql/sp_pcontext.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-08-09 12:08:11 +0400
committerAlexander Barkov <bar@mariadb.org>2017-04-05 15:02:39 +0400
commit36b80caed12cd629c7b067eb9e3273832fe6a4d0 (patch)
tree53710060e4ed8fb8e585326326fb5e3f9bed9db2 /sql/sp_pcontext.h
parent0281757e824bfac4d68b24400d2cc74ced1093ca (diff)
downloadmariadb-git-36b80caed12cd629c7b067eb9e3273832fe6a4d0.tar.gz
Moving the code from *.yy to new methods to LEX and sp_context
Adding: LEX::sp_variable_declarations_init() LEX::sp_variable_declarations_finalize() LEX::sp_handler_declaration_init() LEX::sp_handler_declaration_finalize() LEX::sp_declare_cursor() sp_context::declare_condition()
Diffstat (limited to 'sql/sp_pcontext.h')
-rw-r--r--sql/sp_pcontext.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h
index 2a080536b8a..1ef99219e8e 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -192,7 +192,7 @@ public:
sp_condition_value *value;
public:
- sp_condition(LEX_STRING _name, sp_condition_value *_value)
+ sp_condition(const LEX_STRING _name, sp_condition_value *_value)
:Sql_alloc(),
name(_name),
value(_value)
@@ -422,11 +422,22 @@ public:
// Conditions.
/////////////////////////////////////////////////////////////////////////
- bool add_condition(THD *thd, LEX_STRING name, sp_condition_value *value);
+ bool add_condition(THD *thd, const LEX_STRING name,
+ sp_condition_value *value);
/// See comment for find_variable() above.
- sp_condition_value *find_condition(LEX_STRING name,
+ sp_condition_value *find_condition(const LEX_STRING name,
bool current_scope_only) const;
+ bool declare_condition(THD *thd, const LEX_STRING name,
+ sp_condition_value *val)
+ {
+ if (find_condition(name, true))
+ {
+ my_error(ER_SP_DUP_COND, MYF(0), name.str);
+ return true;
+ }
+ return add_condition(thd, name, val);
+ }
/////////////////////////////////////////////////////////////////////////
// Handlers.
@@ -467,10 +478,11 @@ public:
// Cursors.
/////////////////////////////////////////////////////////////////////////
- bool add_cursor(LEX_STRING name);
+ bool add_cursor(const LEX_STRING name);
/// See comment for find_variable() above.
- bool find_cursor(LEX_STRING name, uint *poff, bool current_scope_only) const;
+ bool find_cursor(const LEX_STRING name,
+ uint *poff, bool current_scope_only) const;
/// Find cursor by offset (for debugging only).
const LEX_STRING *find_cursor(uint offset) const;