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