MySQL  8.0.27
Source Code Documentation
sp_pcontext.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 /* Copyright (c) 2002, 2021, Oracle and/or its affiliates.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License, version 2.0,
6  as published by the Free Software Foundation.
7 
8  This program is also distributed with certain software (including
9  but not limited to OpenSSL) that is licensed under separate terms,
10  as designated in a particular file or component or in included license
11  documentation. The authors of MySQL hereby grant you an additional
12  permission to link the program and your derivative works with the
13  separately licensed software that they have included with MySQL.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License, version 2.0, for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23 
24 #ifndef _SP_PCONTEXT_H_
25 #define _SP_PCONTEXT_H_
26 
27 #include <assert.h>
28 #include <string.h>
29 #include <sys/types.h>
30 
31 #include "field_types.h" // enum_field_types
32 #include "lex_string.h"
33 
34 #include "mysql_com.h"
35 #include "sql/create_field.h" // Create_field
36 #include "sql/mem_root_array.h" // Mem_root_array
37 #include "sql/sql_error.h"
38 #include "sql/sql_list.h"
39 
40 class Item;
41 class String;
42 class THD;
43 class sp_pcontext;
44 
45 /// This class represents a stored program variable or a parameter
46 /// (also referenced as 'SP-variable').
47 
48 class sp_variable {
49  public:
51 
52  /// Name of the SP-variable.
54 
55  /// Field-type of the SP-variable.
57 
58  /// Mode of the SP-variable.
60 
61  /// The index to the variable's value in the runtime frame.
62  ///
63  /// It is calculated during parsing and used when creating sp_instr_set
64  /// instructions and Item_splocal items. I.e. values are set/referred by
65  /// array indexing in runtime.
67 
68  /// Default value of the SP-variable (if any).
70 
71  /// Full type information (field meta-data) of the SP-variable.
73 
74  public:
76  uint _offset)
77  : name(_name),
78  type(_type),
79  mode(_mode),
80  offset(_offset),
82 };
83 
84 ///////////////////////////////////////////////////////////////////////////
85 
86 /// This class represents an SQL/PSM label. Can refer to the identifier
87 /// used with the "label_name:" construct which may precede some SQL/PSM
88 /// statements, or to an implicit implementation-dependent identifier which
89 /// the parser inserts before a high-level flow control statement such as
90 /// IF/WHILE/REPEAT/LOOP, when such statement is rewritten into a
91 /// combination of low-level jump/jump_if instructions and labels.
92 
93 class sp_label {
94  public:
95  enum enum_type {
96  /// Implicit label generated by parser.
98 
99  /// Label at BEGIN.
101 
102  /// Label at iteration control
103  ITERATION
104  };
105 
106  /// Name of the label.
108 
109  /// Instruction pointer of the label.
111 
112  /// Type of the label.
114 
115  /// Scope of the label.
116  class sp_pcontext *ctx;
117 
118  public:
119  sp_label(LEX_CSTRING _name, uint _ip, enum_type _type, sp_pcontext *_ctx)
120  : name(_name), ip(_ip), type(_type), ctx(_ctx) {}
121 };
122 
123 ///////////////////////////////////////////////////////////////////////////
124 
125 /// This class represents condition-value term in DECLARE CONDITION or
126 /// DECLARE HANDLER statements. sp_condition_value has little to do with
127 /// SQL-conditions.
128 ///
129 /// In some sense, this class is a union -- a set of filled attributes
130 /// depends on the sp_condition_value::type value.
131 
133  public:
135 
136  /// Type of the condition value.
138 
139  /// SQLSTATE of the condition value.
141 
142  /// MySQL error code of the condition value.
144 
145  public:
146  sp_condition_value(uint _mysqlerr) : type(ERROR_CODE), mysqlerr(_mysqlerr) {}
147 
148  sp_condition_value(const char *_sql_state) : type(SQLSTATE) {
149  memcpy(sql_state, _sql_state, SQLSTATE_LENGTH);
151  }
152 
154  assert(type != ERROR_CODE && type != SQLSTATE);
155  }
156 
157  /// Print a condition_value in human-readable form.
158  ///
159  /// @param str The variable to print to.
160  void print(String *str) const;
161 
162  /// Check if two instances of sp_condition_value are equal or not.
163  ///
164  /// @param cv another instance of sp_condition_value to check.
165  ///
166  /// @return true if the instances are equal, false otherwise.
167  bool equals(const sp_condition_value *cv) const;
168 };
169 
170 ///////////////////////////////////////////////////////////////////////////
171 
172 /// This class represents 'DECLARE CONDITION' statement.
173 /// sp_condition has little to do with SQL-conditions.
174 
176  public:
177  /// Name of the condition.
179 
180  /// Value of the condition.
182 
183  public:
185  : name(_name), value(_value) {}
186 };
187 
188 ///////////////////////////////////////////////////////////////////////////
189 
190 /// This class represents 'DECLARE HANDLER' statement.
191 
192 class sp_handler {
193  public:
194  /// Enumeration of possible handler types.
195  /// Note: UNDO handlers are not (and have never been) supported.
197 
198  /// Handler type.
200 
201  /// BEGIN..END block of the handler.
203 
204  /// Conditions caught by this handler.
206 
207  public:
208  /// The constructor.
209  ///
210  /// @param _type SQL-handler type.
211  /// @param _scope Handler scope.
213  : type(_type), scope(_scope) {}
214 
215  /// Print all conditions of a handler in human-readable form.
216  ///
217  /// @param str The variable to print to.
218  void print_conditions(String *str) const;
219 
220  /// Print type and conditions (but not body) of a handler.
221  ///
222  /// @param str The variable to print to.
223  void print(String *str) const;
224 };
225 
226 ///////////////////////////////////////////////////////////////////////////
227 
228 /// The class represents parse-time context, which keeps track of declared
229 /// variables/parameters, conditions, handlers, cursors and labels.
230 ///
231 /// sp_context objects are organized in a tree according to the following
232 /// rules:
233 /// - one sp_pcontext object corresponds for for each BEGIN..END block;
234 /// - one sp_pcontext object corresponds for each exception handler;
235 /// - one additional sp_pcontext object is created to contain
236 /// Stored Program parameters.
237 ///
238 /// sp_pcontext objects are used both at parse-time and at runtime.
239 ///
240 /// During the parsing stage sp_pcontext objects are used:
241 /// - to look up defined names (e.g. declared variables and visible
242 /// labels);
243 /// - to check for duplicates;
244 /// - for error checking;
245 /// - to calculate offsets to be used at runtime.
246 ///
247 /// During the runtime phase, a tree of sp_pcontext objects is used:
248 /// - for error checking (e.g. to check correct number of parameters);
249 /// - to resolve SQL-handlers.
250 
251 class sp_pcontext {
252  public:
253  enum enum_scope {
254  /// REGULAR_SCOPE designates regular BEGIN ... END blocks.
256 
257  /// HANDLER_SCOPE designates SQL-handler blocks.
259  };
260 
261  public:
262  sp_pcontext(THD *thd);
263  ~sp_pcontext();
264 
265  /// Create and push a new context in the tree.
266 
267  /// @param thd thread context.
268  /// @param scope scope of the new parsing context.
269  /// @return the node created.
270  sp_pcontext *push_context(THD *thd, enum_scope scope);
271 
272  /// Pop a node from the parsing context tree.
273  /// @return the parent node.
275 
276  sp_pcontext *parent_context() const { return m_parent; }
277 
278  int get_level() const { return m_level; }
279 
280  /// Calculate and return the number of handlers to pop between the given
281  /// context and this one.
282  ///
283  /// @param ctx the other parsing context.
284  /// @param exclusive specifies if the last scope should be excluded.
285  ///
286  /// @return the number of handlers to pop between the given context and
287  /// this one. If 'exclusive' is true, don't count the last scope we are
288  /// leaving; this is used for LEAVE where we will jump to the hpop
289  /// instructions.
290  size_t diff_handlers(const sp_pcontext *ctx, bool exclusive) const;
291 
292  /// Calculate and return the number of cursors to pop between the given
293  /// context and this one.
294  ///
295  /// @param ctx the other parsing context.
296  /// @param exclusive specifies if the last scope should be excluded.
297  ///
298  /// @return the number of cursors to pop between the given context and
299  /// this one. If 'exclusive' is true, don't count the last scope we are
300  /// leaving; this is used for LEAVE where we will jump to the cpop
301  /// instructions.
302  size_t diff_cursors(const sp_pcontext *ctx, bool exclusive) const;
303 
304  /////////////////////////////////////////////////////////////////////////
305  // SP-variables (parameters and variables).
306  /////////////////////////////////////////////////////////////////////////
307 
308  /// @return the maximum number of variables used in this and all child
309  /// contexts. For the root parsing context, this gives us the number of
310  /// slots needed for variables during the runtime phase.
311  uint max_var_index() const { return m_max_var_index; }
312 
313  /// @return the current number of variables used in the parent contexts
314  /// (from the root), including this context.
316  return m_var_offset + static_cast<uint>(m_vars.size());
317  }
318 
319  /// @return the number of variables in this context alone.
320  uint context_var_count() const { return static_cast<uint>(m_vars.size()); }
321 
322  /// @return map index in this parsing context to runtime offset.
323  uint var_context2runtime(uint i) const { return m_var_offset + i; }
324 
325  /// Add SP-variable to the parsing context.
326  ///
327  /// @param thd Thread context.
328  /// @param name Name of the SP-variable.
329  /// @param type Type of the SP-variable.
330  /// @param mode Mode of the SP-variable.
331  ///
332  /// @return instance of newly added SP-variable.
334  enum enum_field_types type,
336 
337  /// Retrieve full type information about SP-variables in this parsing
338  /// context and its children.
339  ///
340  /// @param [out] field_def_lst Container to store type information.
341  void retrieve_field_definitions(List<Create_field> *field_def_lst) const;
342 
343  /// Find SP-variable by name.
344  ///
345  /// The function does a linear search (from newer to older variables,
346  /// in case we have shadowed names).
347  ///
348  /// The function is called only at parsing time.
349  ///
350  /// @param name Variable name.
351  /// @param name_len Variable name length.
352  /// @param current_scope_only A flag if we search only in current scope.
353  ///
354  /// @return instance of found SP-variable, or NULL if not found.
355  sp_variable *find_variable(const char *name, size_t name_len,
356  bool current_scope_only) const;
357 
358  /// Find SP-variable by the offset in the root parsing context.
359  ///
360  /// The function is used for two things:
361  /// - When evaluating parameters at the beginning, and setting out parameters
362  /// at the end, of invocation. (Top frame only, so no recursion then.)
363  /// - For printing of sp_instr_set. (Debug mode only.)
364  ///
365  /// @param offset Variable offset in the root parsing context.
366  ///
367  /// @return instance of found SP-variable, or NULL if not found.
368  sp_variable *find_variable(uint offset) const;
369 
370  /// Set the current scope boundary (for default values).
371  ///
372  /// @param n The number of variables to skip.
374 
375  /////////////////////////////////////////////////////////////////////////
376  // CASE expressions.
377  /////////////////////////////////////////////////////////////////////////
378 
379  int get_num_case_exprs() const { return m_num_case_exprs; }
380 
383 
384  return m_num_case_exprs++;
385  }
386 
388 
390 
391  /////////////////////////////////////////////////////////////////////////
392  // Labels.
393  /////////////////////////////////////////////////////////////////////////
394 
396 
398 
400  sp_label *label = m_labels.head();
401 
402  if (!label && m_parent) label = m_parent->last_label();
403 
404  return label;
405  }
406 
407  sp_label *pop_label() { return m_labels.pop(); }
408 
409  /////////////////////////////////////////////////////////////////////////
410  // Conditions.
411  /////////////////////////////////////////////////////////////////////////
412 
414 
415  /// See comment for find_variable() above.
417  bool current_scope_only) const;
418 
419  /////////////////////////////////////////////////////////////////////////
420  // Handlers.
421  /////////////////////////////////////////////////////////////////////////
422 
424 
425  /// This is an auxilary parsing-time function to check if an SQL-handler
426  /// exists in the current parsing context (current scope) for the given
427  /// SQL-condition. This function is used to check for duplicates during
428  /// the parsing phase.
429  ///
430  /// This function can not be used during the runtime phase to check
431  /// SQL-handler existence because it searches for the SQL-handler in the
432  /// current scope only (during runtime, current and parent scopes
433  /// should be checked according to the SQL-handler resolution rules).
434  ///
435  /// @param cond_value the handler condition value
436  /// (not SQL-condition!).
437  ///
438  /// @retval true if such SQL-handler exists.
439  /// @retval false otherwise.
440  bool check_duplicate_handler(const sp_condition_value *cond_value) const;
441 
442  /// Find an SQL handler for the given SQL condition according to the
443  /// SQL-handler resolution rules. This function is used at runtime.
444  ///
445  /// @param sql_state The SQL condition state
446  /// @param sql_errno The error code
447  /// @param severity The SQL condition severity level
448  ///
449  /// @return a pointer to the found SQL-handler or NULL.
450  sp_handler *find_handler(const char *sql_state, uint sql_errno,
451  Sql_condition::enum_severity_level severity) const;
452 
453  /////////////////////////////////////////////////////////////////////////
454  // Cursors.
455  /////////////////////////////////////////////////////////////////////////
456 
457  bool add_cursor(LEX_STRING name);
458 
459  /// See comment for find_variable() above.
460  bool find_cursor(LEX_STRING name, uint *poff, bool current_scope_only) const;
461 
462  /// Find cursor by offset (for debugging only).
463  const LEX_STRING *find_cursor(uint offset) const;
464 
466  return m_max_cursor_index + static_cast<uint>(m_cursors.size());
467  }
468 
470  return m_cursor_offset + static_cast<uint>(m_cursors.size());
471  }
472 
473  private:
474  /// Constructor for a tree node.
475  /// @param thd thread context
476  /// @param prev the parent parsing context
477  /// @param scope scope of this parsing context
478  sp_pcontext(THD *thd, sp_pcontext *prev, enum_scope scope);
479 
480  void init(uint var_offset, uint cursor_offset, int num_case_expressions);
481 
482  /* Prevent use of these */
485 
486  private:
487  /// Level of the corresponding BEGIN..END block (0 means the topmost block).
488  int m_level;
489 
490  /// m_max_var_index -- number of variables (including all types of arguments)
491  /// in this context including all children contexts.
492  ///
493  /// m_max_var_index >= m_vars.size().
494  ///
495  /// m_max_var_index of the root parsing context contains number of all
496  /// variables (including arguments) in all enclosed contexts.
498 
499  /// The maximum sub context's framesizes.
501 
502  /// Parent context.
504 
505  /// An index of the first SP-variable in this parsing context. The index
506  /// belongs to a runtime table of SP-variables.
507  ///
508  /// Note:
509  /// - m_var_offset is 0 for root parsing context;
510  /// - m_var_offset is different for all nested parsing contexts.
512 
513  /// Cursor offset for this context.
515 
516  /// Boundary for finding variables in this context. This is the number of
517  /// variables currently "invisible" to default clauses. This is normally 0,
518  /// but will be larger during parsing of DECLARE ... DEFAULT, to get the
519  /// scope right for DEFAULT values.
521 
523 
524  /// SP parameters/variables.
526 
527  /// Stack of CASE expression ids.
529 
530  /// Stack of SQL-conditions.
532 
533  /// Stack of cursors.
535 
536  /// Stack of SQL-handlers.
538 
539  /// List of labels.
541 
542  /// Children contexts, used for destruction.
544 
545  /// Scope of this parsing context.
547 };
548 
549 #endif /* _SP_PCONTEXT_H_ */
Create_field is a description a field/column that may or may not exists in a table.
Definition: create_field.h:50
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
T * pop()
Definition: sql_list.h:462
T * head()
Definition: sql_list.h:457
Element_type & back()
Definition: mem_root_array.h:103
bool push_back(const Element_type &element)
Adds a new element at the end of the array, after its current last element.
Definition: mem_root_array.h:182
size_t size() const
Definition: mem_root_array.h:399
void pop_back()
Removes the last element in the array, effectively reducing the container size by one.
Definition: mem_root_array.h:243
enum_severity_level
Enumeration value describing the severity of the condition.
Definition: sql_error.h:59
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:165
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
This class represents condition-value term in DECLARE CONDITION or DECLARE HANDLER statements.
Definition: sp_pcontext.h:132
bool equals(const sp_condition_value *cv) const
Check if two instances of sp_condition_value are equal or not.
Definition: sp_pcontext.cc:34
sp_condition_value(const char *_sql_state)
Definition: sp_pcontext.h:148
char sql_state[SQLSTATE_LENGTH+1]
SQLSTATE of the condition value.
Definition: sp_pcontext.h:140
sp_condition_value(enum_type _type)
Definition: sp_pcontext.h:153
uint mysqlerr
MySQL error code of the condition value.
Definition: sp_pcontext.h:143
void print(String *str) const
Print a condition_value in human-readable form.
Definition: sp_pcontext.cc:53
enum_type type
Type of the condition value.
Definition: sp_pcontext.h:137
sp_condition_value(uint _mysqlerr)
Definition: sp_pcontext.h:146
enum_type
Definition: sp_pcontext.h:134
@ ERROR_CODE
Definition: sp_pcontext.h:134
@ SQLSTATE
Definition: sp_pcontext.h:134
@ EXCEPTION
Definition: sp_pcontext.h:134
@ NOT_FOUND
Definition: sp_pcontext.h:134
@ WARNING
Definition: sp_pcontext.h:134
This class represents 'DECLARE CONDITION' statement.
Definition: sp_pcontext.h:175
sp_condition_value * value
Value of the condition.
Definition: sp_pcontext.h:181
sp_condition(LEX_STRING _name, sp_condition_value *_value)
Definition: sp_pcontext.h:184
LEX_STRING name
Name of the condition.
Definition: sp_pcontext.h:178
This class represents 'DECLARE HANDLER' statement.
Definition: sp_pcontext.h:192
sp_handler(enum_type _type, sp_pcontext *_scope)
The constructor.
Definition: sp_pcontext.h:212
void print_conditions(String *str) const
Print all conditions of a handler in human-readable form.
Definition: sp_pcontext.cc:78
enum_type
Enumeration of possible handler types.
Definition: sp_pcontext.h:196
@ EXIT
Definition: sp_pcontext.h:196
@ CONTINUE
Definition: sp_pcontext.h:196
void print(String *str) const
Print type and conditions (but not body) of a handler.
Definition: sp_pcontext.cc:91
List< const sp_condition_value > condition_values
Conditions caught by this handler.
Definition: sp_pcontext.h:205
enum_type type
Handler type.
Definition: sp_pcontext.h:199
sp_pcontext * scope
BEGIN..END block of the handler.
Definition: sp_pcontext.h:202
This class represents an SQL/PSM label.
Definition: sp_pcontext.h:93
LEX_CSTRING name
Name of the label.
Definition: sp_pcontext.h:107
sp_label(LEX_CSTRING _name, uint _ip, enum_type _type, sp_pcontext *_ctx)
Definition: sp_pcontext.h:119
enum_type type
Type of the label.
Definition: sp_pcontext.h:113
class sp_pcontext * ctx
Scope of the label.
Definition: sp_pcontext.h:116
uint ip
Instruction pointer of the label.
Definition: sp_pcontext.h:110
enum_type
Definition: sp_pcontext.h:95
@ IMPLICIT
Implicit label generated by parser.
Definition: sp_pcontext.h:97
@ ITERATION
Label at iteration control.
Definition: sp_pcontext.h:103
@ BEGIN
Label at BEGIN.
Definition: sp_pcontext.h:100
The class represents parse-time context, which keeps track of declared variables/parameters,...
Definition: sp_pcontext.h:251
sp_pcontext(THD *thd)
Definition: sp_pcontext.cc:116
int get_current_case_expr_id() const
Definition: sp_pcontext.h:389
uint m_pboundary
Boundary for finding variables in this context.
Definition: sp_pcontext.h:520
uint m_max_cursor_index
The maximum sub context's framesizes.
Definition: sp_pcontext.h:500
size_t diff_cursors(const sp_pcontext *ctx, bool exclusive) const
Calculate and return the number of cursors to pop between the given context and this one.
Definition: sp_pcontext.cc:191
uint context_var_count() const
Definition: sp_pcontext.h:320
int get_num_case_exprs() const
Definition: sp_pcontext.h:379
int m_num_case_exprs
Definition: sp_pcontext.h:522
List< sp_label > m_labels
List of labels.
Definition: sp_pcontext.h:540
sp_label * last_label()
Definition: sp_pcontext.h:399
sp_condition_value * find_condition(LEX_STRING name, bool current_scope_only) const
See comment for find_variable() above.
Definition: sp_pcontext.cc:286
uint current_var_count() const
Definition: sp_pcontext.h:315
sp_pcontext(const sp_pcontext &)
Mem_root_array< sp_variable * > m_vars
SP parameters/variables.
Definition: sp_pcontext.h:525
Mem_root_array< sp_pcontext * > m_children
Children contexts, used for destruction.
Definition: sp_pcontext.h:543
sp_pcontext * m_parent
Parent context.
Definition: sp_pcontext.h:503
void declare_var_boundary(uint n)
Set the current scope boundary (for default values).
Definition: sp_pcontext.h:373
sp_pcontext * push_context(THD *thd, enum_scope scope)
Create and push a new context in the tree.
Definition: sp_pcontext.cc:154
int push_case_expr_id()
Definition: sp_pcontext.h:381
uint m_cursor_offset
Cursor offset for this context.
Definition: sp_pcontext.h:514
void pop_case_expr_id()
Definition: sp_pcontext.h:387
uint m_var_offset
An index of the first SP-variable in this parsing context.
Definition: sp_pcontext.h:511
bool add_cursor(LEX_STRING name)
Definition: sp_pcontext.cc:422
enum_scope
Definition: sp_pcontext.h:253
@ HANDLER_SCOPE
HANDLER_SCOPE designates SQL-handler blocks.
Definition: sp_pcontext.h:258
@ REGULAR_SCOPE
REGULAR_SCOPE designates regular BEGIN ... END blocks.
Definition: sp_pcontext.h:255
int m_level
Level of the corresponding BEGIN..END block (0 means the topmost block).
Definition: sp_pcontext.h:488
uint max_cursor_index() const
Definition: sp_pcontext.h:465
bool check_duplicate_handler(const sp_condition_value *cond_value) const
This is an auxilary parsing-time function to check if an SQL-handler exists in the current parsing co...
Definition: sp_pcontext.cc:312
sp_variable * add_variable(THD *thd, LEX_STRING name, enum enum_field_types type, sp_variable::enum_mode mode)
Add SP-variable to the parsing context.
Definition: sp_pcontext.cc:232
sp_variable * find_variable(const char *name, size_t name_len, bool current_scope_only) const
Find SP-variable by name.
Definition: sp_pcontext.cc:205
bool add_condition(THD *thd, LEX_STRING name, sp_condition_value *value)
Definition: sp_pcontext.cc:277
uint max_var_index() const
Definition: sp_pcontext.h:311
sp_handler * add_handler(THD *thd, sp_handler::enum_type type)
Definition: sp_pcontext.cc:304
uint var_context2runtime(uint i) const
Definition: sp_pcontext.h:323
sp_label * pop_label()
Definition: sp_pcontext.h:407
uint m_max_var_index
m_max_var_index – number of variables (including all types of arguments) in this context including al...
Definition: sp_pcontext.h:497
void init(uint var_offset, uint cursor_offset, int num_case_expressions)
Definition: sp_pcontext.cc:107
uint current_cursor_count() const
Definition: sp_pcontext.h:469
sp_label * push_label(THD *thd, LEX_CSTRING name, uint ip)
Definition: sp_pcontext.cc:245
int get_level() const
Definition: sp_pcontext.h:278
Mem_root_array< sp_condition * > m_conditions
Stack of SQL-conditions.
Definition: sp_pcontext.h:531
void retrieve_field_definitions(List< Create_field > *field_def_lst) const
Retrieve full type information about SP-variables in this parsing context and its children.
Definition: sp_pcontext.cc:447
Mem_root_array< LEX_STRING > m_cursors
Stack of cursors.
Definition: sp_pcontext.h:534
bool find_cursor(LEX_STRING name, uint *poff, bool current_scope_only) const
See comment for find_variable() above.
Definition: sp_pcontext.cc:428
sp_label * find_label(LEX_CSTRING name)
Definition: sp_pcontext.cc:256
Mem_root_array< int > m_case_expr_ids
Stack of CASE expression ids.
Definition: sp_pcontext.h:528
sp_handler * find_handler(const char *sql_state, uint sql_errno, Sql_condition::enum_severity_level severity) const
Find an SQL handler for the given SQL condition according to the SQL-handler resolution rules.
Definition: sp_pcontext.cc:328
size_t diff_handlers(const sp_pcontext *ctx, bool exclusive) const
Calculate and return the number of handlers to pop between the given context and this one.
Definition: sp_pcontext.cc:175
sp_pcontext * pop_context()
Pop a node from the parsing context tree.
Definition: sp_pcontext.cc:162
enum_scope m_scope
Scope of this parsing context.
Definition: sp_pcontext.h:546
Mem_root_array< sp_handler * > m_handlers
Stack of SQL-handlers.
Definition: sp_pcontext.h:537
void operator=(sp_pcontext &)
sp_pcontext * parent_context() const
Definition: sp_pcontext.h:276
~sp_pcontext()
Definition: sp_pcontext.cc:150
This class represents a stored program variable or a parameter (also referenced as 'SP-variable').
Definition: sp_pcontext.h:48
Item * default_value
Default value of the SP-variable (if any).
Definition: sp_pcontext.h:69
enum_mode mode
Mode of the SP-variable.
Definition: sp_pcontext.h:59
LEX_STRING name
Name of the SP-variable.
Definition: sp_pcontext.h:53
enum_mode
Definition: sp_pcontext.h:50
@ MODE_OUT
Definition: sp_pcontext.h:50
@ MODE_IN
Definition: sp_pcontext.h:50
@ MODE_INOUT
Definition: sp_pcontext.h:50
Create_field field_def
Full type information (field meta-data) of the SP-variable.
Definition: sp_pcontext.h:72
sp_variable(LEX_STRING _name, enum_field_types _type, enum_mode _mode, uint _offset)
Definition: sp_pcontext.h:75
uint offset
The index to the variable's value in the runtime frame.
Definition: sp_pcontext.h:66
enum enum_field_types type
Field-type of the SP-variable.
Definition: sp_pcontext.h:56
Dialog Client Authentication nullptr
Definition: dialog.cc:352
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:57
Common definition between mysql server & client.
#define SQLSTATE_LENGTH
Definition: mysql_com.h:74
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1056
mode
Definition: file_handle.h:59
const string value("\"Value\"")
required string type
Definition: replication_group_member_actions.proto:33
case opt name
Definition: sslopt-case.h:32
Definition: mysql_lex_string.h:39
Definition: mysql_lex_string.h:34
unsigned int uint
Definition: uca-dump.cc:29
int n
Definition: xcom_base.cc:505