MySQL 8.4.0
Source Code Documentation
sp_head.h
Go to the documentation of this file.
1/* Copyright (c) 2002, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
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_HEAD_H_
25#define _SP_HEAD_H_
26
27#include <stddef.h>
28#include <sys/types.h>
29#include <string>
30#include <vector>
31
32#include "lex_string.h"
33#include "m_string.h"
34#include "map_helpers.h"
35#include "my_alloc.h"
36#include "my_dbug.h"
37#include "my_inttypes.h"
38#include "my_psi_config.h"
39#include "my_sqlcommand.h"
40#include "my_sys.h"
44#include "mysqld_error.h"
46#include "sql/create_field.h"
47#include "sql/mem_root_array.h" // Mem_root_array
48#include "sql/sql_lex.h"
49#include "sql/sql_list.h"
51#include "sql/table.h"
52
53class Field;
54class Item;
58class THD;
59class sp_head;
60struct CHARSET_INFO;
61struct MY_BITMAP;
62
63/**
64 @defgroup Stored_Routines Stored Routines
65 @ingroup Runtime_Environment
66 @{
67*/
68
69class sp_branch_instr;
70class sp_instr;
71class sp_label;
73class sp_pcontext;
74
75/**
76 Number of PSI_statement_info instruments
77 for internal stored programs statements.
78*/
79#define SP_PSI_STATEMENT_INFO_COUNT 16
80
81#ifdef HAVE_PSI_INTERFACE
82void init_sp_psi_keys(void);
83#endif
84
85///////////////////////////////////////////////////////////////////////////
86
87/**
88 Stored_program_creation_ctx -- base class for creation context of stored
89 programs (stored routines, triggers, events).
90*/
91
93 public:
94 const CHARSET_INFO *get_db_cl() { return m_db_cl; }
95
96 public:
98
99 protected:
100 explicit Stored_program_creation_ctx(THD *thd);
101
103 const CHARSET_INFO *connection_cl,
104 const CHARSET_INFO *db_cl)
105 : Default_object_creation_ctx(client_cs, connection_cl), m_db_cl(db_cl) {}
106
107 protected:
108 void change_env(THD *thd) const override;
109
110 protected:
111 /**
112 db_cl stores the value of the database collation. Both character set
113 and collation attributes are used.
114
115 Database collation is included into the context because it defines the
116 default collation for stored-program variables.
117 */
119};
120
121///////////////////////////////////////////////////////////////////////////
122
123class sp_name {
124 public:
128 bool m_explicit_name; /**< Prepend the db name? */
129
130 sp_name(const LEX_CSTRING &db, const LEX_STRING &name, bool use_explicit_name)
131 : m_db(db), m_name(name), m_explicit_name(use_explicit_name) {
132 m_qname.str = nullptr;
133 m_qname.length = 0;
134 }
135
136 /** Create temporary sp_name object for Sroutine_hash_entry. */
137 sp_name(const Sroutine_hash_entry *rt, char *qname_buff);
138
139 // Init. the qualified name from the db and name.
140 void init_qname(THD *thd); // thd for memroot allocation
141};
142
143///////////////////////////////////////////////////////////////////////////
144
145/**
146 sp_parser_data provides a scope for attributes used at the SP-parsing
147 stage only.
148*/
150 private:
154 };
155
156 public:
163 m_cont_level(0),
166
167 ///////////////////////////////////////////////////////////////////////
168
169 /**
170 Start parsing a stored program body statement.
171
172 This method switches THD::mem_root and THD::m_item_list in order to parse
173 SP-body. The current values are kept to be restored after the body
174 statement is parsed.
175
176 @param thd Thread context.
177 @param sp Stored Program being parsed.
178 */
179 void start_parsing_sp_body(THD *thd, sp_head *sp);
180
181 /**
182 Finish parsing of a stored program body statement.
183
184 This method switches THD::mem_root and THD::m_item_list back when SP-body
185 parsing is completed.
186
187 @param thd Thread context.
188 */
189 void finish_parsing_sp_body(THD *thd);
190
191 /**
192 @retval true if SP-body statement is being parsed.
193 @retval false otherwise.
194 */
195 bool is_parsing_sp_body() const { return m_saved_memroot != nullptr; }
196
197 ///////////////////////////////////////////////////////////////////////
198
199 void process_new_sp_instr(THD *thd, sp_instr *i);
200
201 ///////////////////////////////////////////////////////////////////////
202
203 const char *get_current_stmt_start_ptr() const {
205 }
206
207 void set_current_stmt_start_ptr(const char *stmt_start_ptr) {
208 m_current_stmt_start_ptr = stmt_start_ptr;
209 }
210
211 ///////////////////////////////////////////////////////////////////////
212
213 const char *get_option_start_ptr() const { return m_option_start_ptr; }
214
215 void set_option_start_ptr(const char *option_start_ptr) {
216 m_option_start_ptr = option_start_ptr;
217 }
218
219 ///////////////////////////////////////////////////////////////////////
220
221 const char *get_parameter_start_ptr() const { return m_param_start_ptr; }
222
223 void set_parameter_start_ptr(const char *ptr) { m_param_start_ptr = ptr; }
224
225 const char *get_parameter_end_ptr() const { return m_param_end_ptr; }
226
227 void set_parameter_end_ptr(const char *ptr) { m_param_end_ptr = ptr; }
228
229 ///////////////////////////////////////////////////////////////////////
230
231 const char *get_body_start_ptr() const { return m_body_start_ptr; }
232
233 void set_body_start_ptr(const char *ptr) { m_body_start_ptr = ptr; }
234
235 ///////////////////////////////////////////////////////////////////////
236
237 void push_lex(LEX *lex) { m_lex_stack.push_front(lex); }
238
239 LEX *pop_lex() { return m_lex_stack.pop(); }
240
241 ///////////////////////////////////////////////////////////////////////
242 // Backpatch-list operations.
243 ///////////////////////////////////////////////////////////////////////
244
245 /**
246 Put the instruction on the backpatch list, associated with the label.
247
248 @param i The SP-instruction.
249 @param label The label.
250
251 @return Error flag.
252 */
254
255 /**
256 Update all instruction with the given label in the backpatch list
257 to the given instruction pointer.
258
259 @param label The label.
260 @param dest The instruction pointer.
261 */
262 void do_backpatch(sp_label *label, uint dest);
263
264 ///////////////////////////////////////////////////////////////////////
265 // Backpatch operations for supporting CONTINUE handlers.
266 ///////////////////////////////////////////////////////////////////////
267
268 /**
269 Start a new backpatch level for the SP-instruction requiring continue
270 destination. If the SP-instruction is NULL, the level is just increased.
271
272 @note Only subclasses of sp_lex_branch_instr need backpatching of
273 continue destinations (and no other classes do):
274 - sp_instr_jump_if_not
275 - sp_instr_set_case_expr
276 - sp_instr_jump_case_when
277
278 That's why the methods below accept sp_lex_branch_instr to make this
279 relationship clear. And these two functions are the only places where
280 set_cont_dest() is used, so set_cont_dest() is also a member of
281 sp_lex_branch_instr.
282
283 @todo These functions should probably be declared in a separate
284 interface class, but currently we try to minimize the sp_instr
285 hierarchy.
286
287 @return false always.
288 */
290 ++m_cont_level;
291 return false;
292 }
293
294 /**
295 Add a SP-instruction to the current level.
296
297 @param i The SP-instruction.
298
299 @return Error flag.
300 */
302
303 /**
304 Backpatch (and pop) the current level to the given instruction pointer.
305
306 @param dest The instruction pointer.
307 */
308 void do_cont_backpatch(uint dest);
309
310 private:
311 /// Start of the current statement's query string.
313
314 /// Start of the SET-expression query string.
316
317 /**
318 Stack of LEX-objects. It's needed to handle processing of
319 sub-statements.
320 */
322
323 /**
324 Position in the CREATE PROCEDURE- or CREATE FUNCTION-statement's query
325 string corresponding to the start of parameter declarations (stored
326 procedure or stored function parameters).
327 */
328 const char *m_param_start_ptr;
329
330 /**
331 Position in the CREATE PROCEDURE- or CREATE FUNCTION-statement's query
332 string corresponding to the end of parameter declarations (stored
333 procedure or stored function parameters).
334 */
335 const char *m_param_end_ptr;
336
337 /**
338 Position in the CREATE-/ALTER-stored-program statement's query string
339 corresponding to the start of the first SQL-statement.
340 */
341 const char *m_body_start_ptr;
342
343 /// Instructions needing backpatching
345
346 /**
347 We need a special list for backpatching of instructions with a continue
348 destination (in the case of a continue handler catching an error in
349 the test), since it would otherwise interfere with the normal backpatch
350 mechanism - e.g. jump_if_not instructions have two different destinations
351 which are to be patched differently.
352 Since these occur in a more restricted way (always the same "level" in
353 the code), we don't need the label.
354 */
356
357 /// The current continue backpatch level
359
360 /**********************************************************************
361 The following attributes are used to store THD values during parsing
362 of stored program body.
363
364 @sa start_parsing_sp_body()
365 @sa finish_parsing_sp_body()
366 **********************************************************************/
367
368 /// THD's memroot.
370
371 /// THD's item list.
373};
374
375///////////////////////////////////////////////////////////////////////////
376
377struct SP_TABLE;
378
379/**
380 sp_head represents one instance of a stored program. It might be of any type
381 (stored procedure, function, trigger, event).
382*/
383class sp_head {
384 public:
385 /** Possible values of m_flags */
386 enum {
387 HAS_RETURN = 1, // For FUNCTIONs only: is set if has RETURN
388 MULTI_RESULTS = 8, // Is set if a procedure with SELECT(s)
389 CONTAINS_DYNAMIC_SQL = 16, // Is set if a procedure with PREPARE/EXECUTE
390 IS_INVOKED = 32, // Is set if this sp_head is being used
392 64, // Is set if a procedure with 'set autocommit'
393 /* Is set if a procedure with COMMIT (implicit or explicit) | ROLLBACK */
395 LOG_SLOW_STATEMENTS = 256, // Used by events
396 LOG_GENERAL_LOG = 512, // Used by events
399
400 /**
401 Marks routines that directly (i.e. not by calling other routines)
402 change tables. Note that this flag is set automatically based on
403 type of statements used in the stored routine and is different
404 from routine characteristic provided by user in a form of CONTAINS
405 SQL, READS SQL DATA, MODIFIES SQL DATA clauses. The latter are
406 accepted by parser but pretty much ignored after that.
407 We don't rely on them:
408 a) for compatibility reasons.
409 b) because in CONTAINS SQL case they don't provide enough
410 information anyway.
411 */
413 /**
414 Set when a stored program contains sub-statement(s) that creates or drops
415 temporary table(s). When set, used to mark invoking statement as unsafe to
416 be binlogged in STATEMENT format, when in MIXED mode.
417 */
418 HAS_TEMP_TABLE_DDL = 8192
419 };
420
421 public:
422 /************************************************************************
423 Public attributes.
424 ************************************************************************/
425
426 /// Stored program type.
428
429 /// Stored program flags.
431
432 /**
433 Instrumentation interface for SP.
434 */
436
437 /**
438 Definition of the RETURN-field (from the RETURNS-clause).
439 It's used (and valid) for stored functions only.
440 */
442
443 /// Attributes used during the parsing stage only.
445
446 /// Stored program characteristics.
448
449 /// Code if language is not SQL
451
452 /**
453 The value of sql_mode system variable at the CREATE-time.
454
455 It should be stored along with the character sets in the
456 Stored_program_creation_ctx.
457 */
459
460 /// Fully qualified name (@<db name@>.@<sp name@>).
462
463 bool m_explicit_name; ///< Prepend the db name? */
464
472
475
476 /// Recursion level of the current SP instance. The levels are numbered from
477 /// 0.
479
480 /**
481 A list of different recursion level instances for the same procedure.
482 For every recursion level we have an sp_head instance. This instances
483 connected in the list. The list ordered by increasing recursion level
484 (m_recursion_level).
485 */
487
488 /// Pointer to the first element of the above list
490
491 /**
492 Pointer to the first free (non-INVOKED) routine in the list of
493 cached instances for this SP. This pointer is set only for the first
494 SP in the list of instances (see above m_first_cached_sp pointer).
495 The pointer equal to 0 if we have no free instances.
496 For non-first instance value of this pointer meaningless (point to itself);
497 */
499
500 /**
501 Pointer to the last element in the list of instances of the SP.
502 For non-first instance value of this pointer meaningless (point to itself);
503 */
505
506 /**
507 Set containing names of stored routines used by this routine.
508 Note that unlike elements of similar set for statement elements of this
509 set are not linked in one list. Because of this we are able save memory
510 by using for this set same objects that are used in 'sroutines' sets
511 for statements of which this stored routine consists.
512
513 See Sroutine_hash_entry for explanation why this hash uses binary
514 key comparison.
515 */
517
518 /*
519 Security context for stored routine which should be run under
520 definer privileges.
521 */
523
524 /////////////////////////////////////////////////////////////////////////
525 // Trigger-specific public attributes.
526 /////////////////////////////////////////////////////////////////////////
527
528 /**
529 List of item (Item_trigger_field objects)'s lists representing fields
530 in old/new version of row in trigger. We use this list for checking
531 whether all such fields are valid or not at trigger creation time and for
532 binding these fields to TABLE object at table open (although for latter
533 pointer to table being opened is probably enough).
534 */
536 /**
537 List of all the Item_trigger_field items created while parsing
538 sp instruction. After parsing, in add_instr method this list
539 is moved to per instruction Item_trigger_field list
540 "sp_lex_instr::m_trig_field_list".
541 */
543
544 /// Trigger characteristics.
546
547 /// The Table_trigger_dispatcher instance, where this trigger belongs to.
549
550 public:
551 static void destroy(sp_head *sp);
552
553 /// Is this routine being executed?
554 bool is_invoked() const { return m_flags & IS_INVOKED; }
555
556 /**
557 @returns true if this is an SQL routine, and
558 false if it is an external routine
559 */
560 bool is_sql() const {
561 assert(m_chistics->language.length > 0);
562 return native_strcasecmp(m_chistics->language.str, "SQL") == 0;
563 }
564
565 /**
566 Get the value of the SP cache version, as remembered
567 when the routine was inserted into the cache.
568 */
570
571 /// Set the value of the SP cache version.
574 }
575
577
579 m_creation_ctx = creation_ctx->clone(&main_mem_root);
580 }
581
582 /// Set the body-definition start position.
583 void set_body_start(THD *thd, const char *begin_ptr);
584
585 /// Set the statement-definition (body-definition) end position.
586 void set_body_end(THD *thd);
587
589 GRANT_INFO *subject_table_grant,
590 bool need_fix_fields);
591
592 void mark_used_trigger_fields(TABLE *subject_table);
593
594 bool has_updated_trigger_fields(const MY_BITMAP *used_fields) const;
595
596 /**
597 Execute trigger stored program.
598
599 - changes security context for triggers
600 - switch to new memroot
601 - call sp_head::execute
602 - restore old memroot
603 - restores security context
604
605 @param thd Thread context
606 @param db_name database name
607 @param table_name table name
608 @param grant_info GRANT_INFO structure to be filled with
609 information about definer's privileges
610 on subject table
611
612 @todo
613 We should create sp_rcontext once per command and reuse it
614 on subsequent executions of a trigger.
615
616 @return Error status.
617 */
618 bool execute_trigger(THD *thd, const LEX_CSTRING &db_name,
619 const LEX_CSTRING &table_name, GRANT_INFO *grant_info);
620
621 /**
622 Execute a function.
623
624 - evaluate parameters
625 - changes security context for SUID routines
626 - switch to new memroot
627 - call sp_head::execute
628 - restore old memroot
629 - evaluate the return value
630 - restores security context
631
632 @param thd Thread context.
633 @param args Passed arguments (these are items from containing
634 statement?)
635 @param argcount Number of passed arguments. We need to check if
636 this is correct.
637 @param return_fld Save result here.
638
639 @todo
640 We should create sp_rcontext once per command and reuse
641 it on subsequent executions of a function/trigger.
642
643 @todo
644 In future we should associate call arena/mem_root with
645 sp_rcontext and allocate all these objects (and sp_rcontext
646 itself) on it directly rather than juggle with arenas.
647
648 @return Error status.
649 */
650 bool execute_function(THD *thd, Item **args, uint argcount,
651 Field *return_fld);
652
653 /**
654 Execute a procedure.
655
656 The function does the following steps:
657 - Set all parameters
658 - changes security context for SUID routines
659 - call sp_head::execute
660 - copy back values of INOUT and OUT parameters
661 - restores security context
662
663 @param thd Thread context.
664 @param args List of values passed as arguments.
665
666 @return Error status.
667 */
668
670
671 /**
672 Add instruction to SP.
673
674 @param thd Thread context.
675 @param instr Instruction.
676
677 @return Error status.
678 */
679 bool add_instr(THD *thd, sp_instr *instr);
680
681 /**
682 Returns true if any substatement in the routine directly
683 (not through another routine) modifies data/changes table.
684
685 @sa Comment for MODIFIES_DATA flag.
686 */
687 bool modifies_data() const { return m_flags & MODIFIES_DATA; }
688
689 /**
690 @returns true if stored program has sub-statement(s) to CREATE/DROP
691 temporary table(s).
692 @retval true if HAS_TEMP_TABLE_DDL is set in m_flags.
693 @retval false Otherwise.
694 */
696
697 uint instructions() { return static_cast<uint>(m_instructions.size()); }
698
700
701 /**
702 Reset LEX-object during parsing, before we parse a sub statement.
703
704 @param thd Thread context.
705
706 @return Error status.
707 */
708 bool reset_lex(THD *thd);
709
710 /**
711 Restore LEX-object during parsing, after we have parsed a sub statement.
712
713 @param thd Thread context.
714
715 @return Error status.
716 */
717 bool restore_lex(THD *thd);
718
719 char *name(uint *lenp = nullptr) const {
720 if (lenp) *lenp = (uint)m_name.length;
721 return m_name.str;
722 }
723
724 /**
725 Create Field-object corresponding to the RETURN field of a stored function.
726 This operation makes sense for stored functions only.
727
728 @param thd thread context.
729 @param field_max_length the max length (in the sense of Item classes).
730 @param field_name the field name (item name).
731 @param table the field's table.
732
733 @return newly created and initialized Field-instance,
734 or NULL in case of error.
735 */
736 Field *create_result_field(THD *thd, size_t field_max_length,
737 const char *field_name, TABLE *table) const;
738
739 void returns_type(THD *thd, String *result) const;
740
741 void set_info(longlong created, longlong modified, st_sp_chistics *chistics,
743
744 void set_definer(const char *definer, size_t definerlen);
745 void set_definer(const LEX_CSTRING &user_name, const LEX_CSTRING &host_name);
746
747 /**
748 Do some minimal optimization of the code:
749 -# Mark used instructions
750 -# While doing this, shortcut jumps to jump instructions
751 -# Compact the code, removing unused instructions.
752
753 This is the main mark and move loop; it relies on the following methods
754 in sp_instr and its subclasses:
755
756 - opt_mark() : Mark instruction as reachable
757 - opt_shortcut_jump(): Shortcut jumps to the final destination;
758 used by opt_mark().
759 - opt_move() : Update moved instruction
760 - set_destination() : Set the new destination (jump instructions only)
761 */
762 void optimize();
763
764 /**
765 Helper used during flow analysis during code optimization.
766 See the implementation of <code>opt_mark()</code>.
767 @param ip the instruction to add to the leads list
768 @param leads the list of remaining paths to explore in the graph that
769 represents the code, during flow analysis.
770 */
771 void add_mark_lead(uint ip, List<sp_instr> *leads);
772
773 /**
774 Get SP-instruction at given index.
775
776 NOTE: it is important to have *unsigned* int here, sometimes we get (-1)
777 passed here, so it gets converted to MAX_INT, and the result of the
778 function call is NULL.
779 */
781 return (i < (uint)m_instructions.size()) ? m_instructions.at(i) : nullptr;
782 }
783
784 /**
785 Add tables used by routine to the table list.
786
787 Converts multi-set of tables used by this routine to table list and adds
788 this list to the end of table list specified by 'query_tables_last_ptr'.
789
790 Elements of list will be allocated in PS memroot, so this list will be
791 persistent between PS executions.
792
793 @param[in] thd Thread context
794 @param[in,out] query_tables_last_ptr Pointer to the next_global member of
795 last element of the list where tables
796 will be added (or to its root).
797 @param[in] sql_command SQL-command for which we are adding
798 elements to the table list.
799 @param[in] belong_to_view Uppermost view which uses this
800 routine, NULL if none.
801 */
803 Table_ref ***query_tables_last_ptr,
804 enum_sql_command sql_command,
805 Table_ref *belong_to_view);
806
807 /**
808 Check if this stored routine contains statements disallowed
809 in a stored function or trigger, and set an appropriate error message
810 if this is the case.
811 */
814 my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "Dynamic SQL");
815 else if (m_flags & MULTI_RESULTS)
816 my_error(ER_SP_NO_RETSET, MYF(0), where);
818 my_error(ER_SP_CANT_SET_AUTOCOMMIT, MYF(0));
820 my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
821 else if (m_flags & HAS_SQLCOM_RESET)
822 my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "RESET");
823 else if (m_flags & HAS_SQLCOM_FLUSH)
824 my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "FLUSH");
825
826 return (m_flags &
829 }
830
831#ifndef NDEBUG
832 /**
833 Return the routine instructions as a result set.
834 @return Error status.
835 */
836 bool show_routine_code(THD *thd);
837#endif
838
839 /*
840 This method is intended for attributes of a routine which need
841 to propagate upwards to the Query_tables_list of the caller (when
842 a property of a sp_head needs to "taint" the calling statement).
843 */
845 /*
846 If this routine needs row-based binary logging, the entire top statement
847 too (we cannot switch from statement-based to row-based only for this
848 routine, as in statement-based the top-statement may be binlogged and
849 the sub-statements not).
850 */
851 DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x",
852 prelocking_ctx->get_stmt_unsafe_flags()));
853 DBUG_PRINT("info", ("sp_head(0x%p=%s)->unsafe_flags: 0x%x", this, name(),
854 unsafe_flags));
855 prelocking_ctx->set_stmt_unsafe_flags(unsafe_flags);
856
857 /*
858 If temporary table is created or dropped in the stored program then
859 statement is unsafe to be logged in STATEMENT format, when in MIXED mode.
860 */
862 }
863
864 /**
865 @return root parsing context for this stored program.
866 */
868 return const_cast<sp_pcontext *>(m_root_parsing_ctx);
869 }
870
871 /**
872 @return SP-persistent mem-root. Instructions and expressions are stored in
873 its memory between executions.
874 */
876 return const_cast<MEM_ROOT *>(&main_mem_root);
877 }
878
879 /**
880 Check if a user has access right to a SP.
881
882 @param thd Thread context.
883 @param[out] full_access Set to 1 if the user is the owner
884 of the stored program.
885
886 @return Error status.
887 */
888 bool check_show_access(THD *thd, bool *full_access);
889
890 /**
891 Change routine security context, and check if there is an EXECUTE privilege
892 in new context. If there is no EXECUTE privilege, change the context back
893 and return an error.
894
895 @param thd Thread context.
896 @param[out] save_ctx Where to save the old security context.
897
898 @todo Cache if the definer has the rights to use the object on the first
899 usage and reset the cache only if someone does a GRANT statement that 'may'
900 affect this.
901
902 @return Error status.
903 */
904 bool set_security_ctx(THD *thd, Security_context **save_ctx);
905
906 private:
907 /// Use sp_start_parsing() to create instances of sp_head.
909
910 /// Use destroy() to destoy instances of sp_head.
911 ~sp_head();
912
913 /// SP-persistent memory root (for instructions and expressions).
915
916 /// Root parsing context (topmost BEGIN..END block) of this SP.
918
919 /// The SP-instructions.
921
922 /**
923 Multi-set representing optimized list of tables to be locked by this
924 routine. Does not include tables which are used by invoked routines.
925
926 @note
927 For prelocking-free SPs this multiset is constructed too.
928 We do so because the same instance of sp_head may be called both
929 in prelocked mode and in non-prelocked mode.
930 */
932
933 /*
934 The same information as in m_sptabs, but sorted (by an arbitrary key).
935 This is useful to get consistent locking order, which makes MTR tests
936 more deterministic across platforms. It does not have a bearing on the
937 actual behavior of the server.
938 */
939 std::vector<SP_TABLE *> m_sptabs_sorted;
940
941 /**
942 Version of the stored routine cache at the moment when the
943 routine was added to it. Is used only for functions and
944 procedures, not used for triggers or events. When sp_head is
945 created, its version is 0. When it's added to the cache, the
946 version is assigned the global value 'Cversion'.
947 If later on Cversion is incremented, we know that the routine
948 is obsolete and should not be used --
949 sp_cache_flush_obsolete() will purge it.
950 */
952
953 /// Snapshot of several system variables at CREATE-time.
955
956 /// Flags of LEX::enum_binlog_stmt_unsafe.
958
959 private:
960 /**
961 language component related state of this sp.
962 */
964
965 public:
966 /**
967 * @brief Get the external program handle object
968 *
969 * @return external_program_handle
970 */
972
973 /**
974 * @brief Set the external program handle object
975 *
976 * @param sp The new external program handle object.
977 * Use nullptr to unset the current one.
978 *
979 * @return true on errors
980 * @return false on success
981 */
983
984 /**
985 Initialize and parse an external routine
986
987 If @ref m_language_stored_program is already set,
988 nothing will be done.
989
990 @param service The_program_execution service that will
991 be used to execute this function
992
993 @returns false on success; true on failure
994 */
996 my_service<SERVICE_TYPE(external_program_execution)> &service);
997
998 private:
999 /// Copy sp name from parser.
1000 void init_sp_name(THD *thd, sp_name *spname);
1001
1002 /**
1003 Execute the routine. The main instruction jump loop is there.
1004 Assume the parameters already set.
1005
1006 @param thd Thread context.
1007 @param merge_da_on_success Flag specifying if Warning Info should be
1008 propagated to the caller on Completion
1009 Condition or not.
1010
1011 @todo
1012 - Will write this SP statement into binlog separately
1013 (TODO: consider changing the condition to "not inside event union")
1014
1015 @return Error status.
1016 */
1017 bool execute(THD *thd, bool merge_da_on_success);
1018
1019 /**
1020 Execute external routine.
1021
1022 @param thd Thread context.
1023
1024 @return Error status.
1025 */
1026 bool execute_external_routine(THD *thd);
1027
1028 /**
1029 Core function for executing the external routine.
1030
1031 @param thd Thread context.
1032
1033 @return Error status.
1034 */
1036
1037 /**
1038 Perform a forward flow analysis in the generated code.
1039 Mark reachable instructions, for the optimizer.
1040 */
1041 void opt_mark();
1042
1043 /**
1044 Merge the list of tables used by some query into the multi-set of
1045 tables used by routine.
1046
1047 @param thd Thread context.
1048 @param table Table list.
1049 @param lex_for_tmp_check LEX of the query for which we are merging
1050 table list.
1051
1052 @note
1053 This method will use LEX provided to check whenever we are creating
1054 temporary table and mark it as such in target multi-set.
1055
1056 @return Error status.
1057 */
1058 bool merge_table_list(THD *thd, Table_ref *table, LEX *lex_for_tmp_check);
1059
1060 friend sp_head *sp_start_parsing(THD *thd, enum_sp_type sp_type,
1061 sp_name *sp_name);
1062
1063 // Prevent use of copy constructor and assignment operator.
1066};
1067
1068///////////////////////////////////////////////////////////////////////////
1069
1070/**
1071 @} (end of group Stored_Routines)
1072*/
1073
1074#endif /* _SP_HEAD_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
Default_object_creation_ctx – default implementation of Object_creation_ctx.
Definition: table.h:224
Definition: field.h:575
Represents NEW/OLD version of field of row which is changed/read in trigger.
Definition: item.h:6739
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:934
Definition: sql_list.h:467
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Definition: sql_lex.h:2596
void set_stmt_unsafe_flags(uint32 flags)
Set the bits of binlog_stmt_flags determining the type of unsafeness of the current statement.
Definition: sql_lex.h:2929
uint32 get_stmt_unsafe_flags() const
Return a binary combination of all unsafe warnings for the statement.
Definition: sql_lex.h:2942
void set_stmt_unsafe_with_mixed_mode()
Definition: sql_lex.h:3170
Simple intrusive linked list.
Definition: sql_list.h:47
A set of THD members describing the current authenticated user.
Definition: sql_security_ctx.h:53
Structure that represents element in the set of stored routines used by statement or routine.
Definition: sp.h:225
Stored_program_creation_ctx – base class for creation context of stored programs (stored routines,...
Definition: sp_head.h:92
const CHARSET_INFO * m_db_cl
db_cl stores the value of the database collation.
Definition: sp_head.h:118
virtual Stored_program_creation_ctx * clone(MEM_ROOT *mem_root)=0
void change_env(THD *thd) const override
Definition: sp_head.cc:3752
Stored_program_creation_ctx(THD *thd)
Definition: sp_head.cc:3748
Stored_program_creation_ctx(const CHARSET_INFO *client_cs, const CHARSET_INFO *connection_cl, const CHARSET_INFO *db_cl)
Definition: sp_head.h:102
const CHARSET_INFO * get_db_cl()
Definition: sp_head.h:94
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
Definition: table.h:2863
This class holds all information about triggers of a table.
Definition: table_trigger_dispatcher.h:63
This is an interface to be used from Item_trigger_field to access information about table trigger fie...
Definition: table_trigger_field_support.h:44
std::unordered_map, but with my_malloc and collation-aware comparison.
Definition: map_helpers.h:219
std::unordered_map, but with my_malloc, so that you can track the memory used using PSI memory keys.
Definition: map_helpers.h:157
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
Wraps my_h_service struct conforming ABI into RAII C++ object with ability to cast to desired service...
Definition: my_service.h:35
An interface for all SP-instructions with destinations that need to be updated by the SP-optimizer.
Definition: sp_instr.h:78
sp_head represents one instance of a stored program.
Definition: sp_head.h:383
void set_creation_ctx(Stored_program_creation_ctx *creation_ctx)
Definition: sp_head.h:578
bool execute_external_routine(THD *thd)
Execute external routine.
Definition: sp_head.cc:2453
@ MULTI_RESULTS
Definition: sp_head.h:388
@ HAS_TEMP_TABLE_DDL
Set when a stored program contains sub-statement(s) that creates or drops temporary table(s).
Definition: sp_head.h:418
@ HAS_SQLCOM_RESET
Definition: sp_head.h:397
@ MODIFIES_DATA
Marks routines that directly (i.e.
Definition: sp_head.h:412
@ LOG_GENERAL_LOG
Definition: sp_head.h:396
@ HAS_COMMIT_OR_ROLLBACK
Definition: sp_head.h:394
@ IS_INVOKED
Definition: sp_head.h:390
@ CONTAINS_DYNAMIC_SQL
Definition: sp_head.h:389
@ HAS_SQLCOM_FLUSH
Definition: sp_head.h:398
@ LOG_SLOW_STATEMENTS
Definition: sp_head.h:395
@ HAS_RETURN
Definition: sp_head.h:387
@ HAS_SET_AUTOCOMMIT_STMT
Definition: sp_head.h:391
bool add_instr(THD *thd, sp_instr *instr)
Add instruction to SP.
Definition: sp_head.cc:3292
bool set_external_program_handle(external_program_handle sp)
Set the external program handle object.
Definition: sp_head.cc:2699
LEX_STRING m_name
Definition: sp_head.h:466
bool execute_function(THD *thd, Item **args, uint argcount, Field *return_fld)
Execute a function.
Definition: sp_head.cc:2729
st_sp_chistics * m_chistics
Stored program characteristics.
Definition: sp_head.h:447
sp_head(MEM_ROOT &&mem_root, enum_sp_type type)
Use sp_start_parsing() to create instances of sp_head.
Definition: sp_head.cc:1703
int64 sp_cache_version() const
Get the value of the SP cache version, as remembered when the routine was inserted into the cache.
Definition: sp_head.h:569
void set_definer(const char *definer, size_t definerlen)
Definition: sp_head.cc:3268
void operator=(sp_head &)
LEX_CSTRING m_body
Definition: sp_head.h:468
bool setup_trigger_fields(THD *thd, Table_trigger_field_support *tfs, GRANT_INFO *subject_table_grant, bool need_fix_fields)
Definition: sp_head.cc:1831
bool has_updated_trigger_fields(const MY_BITMAP *used_fields) const
Check whether any table's fields are used in trigger.
Definition: sp_head.cc:1883
void init_sp_name(THD *thd, sp_name *spname)
Copy sp name from parser.
Definition: sp_head.cc:1753
bool execute_procedure(THD *thd, mem_root_deque< Item * > *args)
Execute a procedure.
Definition: sp_head.cc:2944
void set_body_end(THD *thd)
Set the statement-definition (body-definition) end position.
Definition: sp_head.cc:1782
void set_info(longlong created, longlong modified, st_sp_chistics *chistics, sql_mode_t sql_mode)
Definition: sp_head.cc:3246
ulong m_recursion_level
Recursion level of the current SP instance.
Definition: sp_head.h:478
longlong m_created
Definition: sp_head.h:473
external_program_handle get_external_program_handle()
Get the external program handle object.
Definition: sp_head.cc:2695
sp_head * m_first_instance
Pointer to the first element of the above list.
Definition: sp_head.h:489
uint instructions()
Definition: sp_head.h:697
collation_unordered_map< std::string, SP_TABLE * > m_sptabs
Multi-set representing optimized list of tables to be locked by this routine.
Definition: sp_head.h:931
bool execute(THD *thd, bool merge_da_on_success)
Execute the routine.
Definition: sp_head.cc:1998
Security_context m_security_ctx
Definition: sp_head.h:522
Create_field m_return_field_def
Definition of the RETURN-field (from the RETURNS-clause).
Definition: sp_head.h:441
bool is_sql() const
Definition: sp_head.h:560
uint m_flags
Stored program flags.
Definition: sp_head.h:430
SQL_I_List< SQL_I_List< Item_trigger_field > > m_list_of_trig_fields_item_lists
List of item (Item_trigger_field objects)'s lists representing fields in old/new version of row in tr...
Definition: sp_head.h:535
void add_used_tables_to_table_list(THD *thd, Table_ref ***query_tables_last_ptr, enum_sql_command sql_command, Table_ref *belong_to_view)
Add tables used by routine to the table list.
Definition: sp_head.cc:3543
friend sp_head * sp_start_parsing(THD *thd, enum_sp_type sp_type, sp_name *sp_name)
Start parsing of a stored program.
Definition: sp.cc:2237
int64 m_sp_cache_version
Version of the stored routine cache at the moment when the routine was added to it.
Definition: sp_head.h:951
sp_pcontext * m_root_parsing_ctx
Root parsing context (topmost BEGIN..END block) of this SP.
Definition: sp_head.h:917
LEX_STRING m_params
Definition: sp_head.h:467
bool show_routine_code(THD *thd)
Return the routine instructions as a result set.
Definition: sp_head.cc:3397
class Table_trigger_dispatcher * m_trg_list
The Table_trigger_dispatcher instance, where this trigger belongs to.
Definition: sp_head.h:548
malloc_unordered_map< std::string, Sroutine_hash_entry * > m_sroutines
Set containing names of stored routines used by this routine.
Definition: sp_head.h:516
std::vector< SP_TABLE * > m_sptabs_sorted
Definition: sp_head.h:939
LEX_STRING m_db
Definition: sp_head.h:465
Field * create_result_field(THD *thd, size_t field_max_length, const char *field_name, TABLE *table) const
Create Field-object corresponding to the RETURN field of a stored function.
Definition: sp_head.cc:1937
bool check_show_access(THD *thd, bool *full_access)
Check if a user has access right to a SP.
Definition: sp_head.cc:3616
void set_sp_cache_version(int64 sp_cache_version)
Set the value of the SP cache version.
Definition: sp_head.h:572
bool m_explicit_name
Prepend the db name? *‍/.
Definition: sp_head.h:463
bool is_not_allowed_in_function(const char *where)
Check if this stored routine contains statements disallowed in a stored function or trigger,...
Definition: sp_head.h:812
void mark_used_trigger_fields(TABLE *subject_table)
Definition: sp_head.cc:1853
void returns_type(THD *thd, String *result) const
Definition: sp_head.cc:1971
LEX_CSTRING m_body_utf8
Definition: sp_head.h:469
Mem_root_array< sp_instr * > m_instructions
The SP-instructions.
Definition: sp_head.h:920
uint32 unsafe_flags
Flags of LEX::enum_binlog_stmt_unsafe.
Definition: sp_head.h:957
Stored_program_creation_ctx * m_creation_ctx
Snapshot of several system variables at CREATE-time.
Definition: sp_head.h:954
bool is_invoked() const
Is this routine being executed?
Definition: sp_head.h:554
LEX_STRING m_qname
Fully qualified name (<db name>.<sp name>).
Definition: sp_head.h:461
bool execute_external_routine_core(THD *thd)
Core function for executing the external routine.
Definition: sp_head.cc:2417
LEX_STRING m_definer_host
Definition: sp_head.h:471
sql_mode_t m_sql_mode
The value of sql_mode system variable at the CREATE-time.
Definition: sp_head.h:458
MEM_ROOT * get_persistent_mem_root() const
Definition: sp_head.h:875
bool merge_table_list(THD *thd, Table_ref *table, LEX *lex_for_tmp_check)
Merge the list of tables used by some query into the multi-set of tables used by routine.
Definition: sp_head.cc:3453
longlong m_modified
Definition: sp_head.h:474
bool restore_lex(THD *thd)
Restore LEX-object during parsing, after we have parsed a sub statement.
Definition: sp_head.cc:3196
static void destroy(sp_head *sp)
Definition: sp_head.cc:1692
~sp_head()
Use destroy() to destoy instances of sp_head.
Definition: sp_head.cc:1902
sp_instr * last_instruction()
Definition: sp_head.h:699
LEX_STRING m_definer_user
Definition: sp_head.h:470
char * name(uint *lenp=nullptr) const
Definition: sp_head.h:719
void set_body_start(THD *thd, const char *begin_ptr)
Set the body-definition start position.
Definition: sp_head.cc:1776
void add_mark_lead(uint ip, List< sp_instr > *leads)
Helper used during flow analysis during code optimization.
Definition: sp_head.cc:3356
bool has_temp_table_ddl() const
Definition: sp_head.h:695
bool execute_trigger(THD *thd, const LEX_CSTRING &db_name, const LEX_CSTRING &table_name, GRANT_INFO *grant_info)
Execute trigger stored program.
Definition: sp_head.cc:2589
PSI_sp_share * m_sp_share
Instrumentation interface for SP.
Definition: sp_head.h:435
sp_parser_data m_parser_data
Attributes used during the parsing stage only.
Definition: sp_head.h:444
Stored_program_creation_ctx * get_creation_ctx()
Definition: sp_head.h:576
sp_head * m_next_cached_sp
A list of different recursion level instances for the same procedure.
Definition: sp_head.h:486
bool reset_lex(THD *thd)
Reset LEX-object during parsing, before we parse a sub statement.
Definition: sp_head.cc:3172
MEM_ROOT main_mem_root
SP-persistent memory root (for instructions and expressions).
Definition: sp_head.h:914
st_trg_chistics m_trg_chistics
Trigger characteristics.
Definition: sp_head.h:545
sp_head * m_first_free_instance
Pointer to the first free (non-INVOKED) routine in the list of cached instances for this SP.
Definition: sp_head.h:498
external_program_handle m_language_stored_program
language component related state of this sp.
Definition: sp_head.h:963
void optimize()
Do some minimal optimization of the code:
Definition: sp_head.cc:3323
enum_sp_type m_type
Stored program type.
Definition: sp_head.h:427
bool modifies_data() const
Returns true if any substatement in the routine directly (not through another routine) modifies data/...
Definition: sp_head.h:687
void propagate_attributes(Query_tables_list *prelocking_ctx)
Definition: sp_head.h:844
sp_head * m_last_cached_sp
Pointer to the last element in the list of instances of the SP.
Definition: sp_head.h:504
void opt_mark()
Perform a forward flow analysis in the generated code.
Definition: sp_head.cc:3362
LEX_CSTRING code
Code if language is not SQL.
Definition: sp_head.h:450
sp_pcontext * get_root_parsing_context() const
Definition: sp_head.h:867
sp_head(const sp_head &)
sp_instr * get_instr(uint i)
Get SP-instruction at given index.
Definition: sp_head.h:780
bool init_external_routine(my_service< const mysql_service_external_program_execution_t > &service)
Initialize and parse an external routine.
Definition: sp_head.cc:2707
bool set_security_ctx(THD *thd, Security_context **save_ctx)
Change routine security context, and check if there is an EXECUTE privilege in new context.
Definition: sp_head.cc:3630
SQL_I_List< Item_trigger_field > m_cur_instr_trig_field_items
List of all the Item_trigger_field items created while parsing sp instruction.
Definition: sp_head.h:542
Base class for every SP-instruction.
Definition: sp_instr.h:105
This class represents an SQL/PSM label.
Definition: sp_pcontext.h:94
sp_lex_branch_instr is a base class for SP-instructions, which might perform conditional jump dependi...
Definition: sp_instr.h:791
Definition: sp_head.h:123
LEX_STRING m_qname
Definition: sp_head.h:127
bool m_explicit_name
Prepend the db name?
Definition: sp_head.h:128
void init_qname(THD *thd)
Init the qualified name from the db and name.
Definition: sp_head.cc:1678
LEX_STRING m_name
Definition: sp_head.h:126
sp_name(const LEX_CSTRING &db, const LEX_STRING &name, bool use_explicit_name)
Definition: sp_head.h:130
LEX_CSTRING m_db
Definition: sp_head.h:125
sp_parser_data provides a scope for attributes used at the SP-parsing stage only.
Definition: sp_head.h:149
const char * m_current_stmt_start_ptr
Start of the current statement's query string.
Definition: sp_head.h:312
void push_lex(LEX *lex)
Definition: sp_head.h:237
uint m_cont_level
The current continue backpatch level.
Definition: sp_head.h:358
bool add_backpatch_entry(sp_branch_instr *i, sp_label *label)
Put the instruction on the backpatch list, associated with the label.
Definition: sp_head.cc:3695
void start_parsing_sp_body(THD *thd, sp_head *sp)
Start parsing a stored program body statement.
Definition: sp_head.cc:3662
Item * m_saved_item_list
THD's item list.
Definition: sp_head.h:372
const char * get_option_start_ptr() const
Definition: sp_head.h:213
const char * m_param_end_ptr
Position in the CREATE PROCEDURE- or CREATE FUNCTION-statement's query string corresponding to the en...
Definition: sp_head.h:335
void do_cont_backpatch(uint dest)
Backpatch (and pop) the current level to the given instruction pointer.
Definition: sp_head.cc:3720
bool is_parsing_sp_body() const
Definition: sp_head.h:195
MEM_ROOT * m_saved_memroot
THD's memroot.
Definition: sp_head.h:369
sp_parser_data()
Definition: sp_head.h:157
const char * m_param_start_ptr
Position in the CREATE PROCEDURE- or CREATE FUNCTION-statement's query string corresponding to the st...
Definition: sp_head.h:328
void process_new_sp_instr(THD *thd, sp_instr *i)
Definition: sp_head.cc:3731
const char * get_parameter_end_ptr() const
Definition: sp_head.h:225
void set_body_start_ptr(const char *ptr)
Definition: sp_head.h:233
void set_parameter_start_ptr(const char *ptr)
Definition: sp_head.h:223
void set_current_stmt_start_ptr(const char *stmt_start_ptr)
Definition: sp_head.h:207
const char * m_body_start_ptr
Position in the CREATE-/ALTER-stored-program statement's query string corresponding to the start of t...
Definition: sp_head.h:341
void set_parameter_end_ptr(const char *ptr)
Definition: sp_head.h:227
List< Backpatch_info > m_backpatch
Instructions needing backpatching.
Definition: sp_head.h:344
LEX * pop_lex()
Definition: sp_head.h:239
bool add_cont_backpatch_entry(sp_lex_branch_instr *i)
Add a SP-instruction to the current level.
Definition: sp_head.cc:3715
List< LEX > m_lex_stack
Stack of LEX-objects.
Definition: sp_head.h:321
const char * m_option_start_ptr
Start of the SET-expression query string.
Definition: sp_head.h:315
List< sp_lex_branch_instr > m_cont_backpatch
We need a special list for backpatching of instructions with a continue destination (in the case of a...
Definition: sp_head.h:355
void set_option_start_ptr(const char *option_start_ptr)
Definition: sp_head.h:215
const char * get_body_start_ptr() const
Definition: sp_head.h:231
bool new_cont_backpatch()
Start a new backpatch level for the SP-instruction requiring continue destination.
Definition: sp_head.h:289
void finish_parsing_sp_body(THD *thd)
Finish parsing of a stored program body statement.
Definition: sp_head.cc:3673
const char * get_parameter_start_ptr() const
Definition: sp_head.h:221
const char * get_current_stmt_start_ptr() const
Definition: sp_head.h:203
void do_backpatch(sp_label *label, uint dest)
Update all instruction with the given label in the backpatch list to the given instruction pointer.
Definition: sp_head.cc:3706
The class represents parse-time context, which keeps track of declared variables/parameters,...
Definition: sp_pcontext.h:252
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
uint64_t sql_mode_t
Definition: dd_event.h:39
enum_sp_type
enum_sp_type defines type codes of stored programs.
Definition: sql_lex.h:224
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:216
void init_sp_psi_keys(void)
Definition: sp_head.cc:1546
struct PSI_sp_share PSI_sp_share
Definition: psi_statement_bits.h:119
struct external_program_handle_imp * external_program_handle
The handle is created by the caller of external_program_execution service.
Definition: language_service.h:37
static int native_strcasecmp(const char *s1, const char *s2)
Definition: m_string.h:207
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
#define DBUG_PRINT(keyword, arglist)
Definition: my_dbug.h:181
Some integer typedefs for easier portability.
int64_t int64
Definition: my_inttypes.h:68
long long int longlong
Definition: my_inttypes.h:55
#define MYF(v)
Definition: my_inttypes.h:97
uint32_t uint32
Definition: my_inttypes.h:67
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
enum_sql_command
Definition: my_sqlcommand.h:46
Common header for many mysys elements.
static char * where
Definition: mysqldump.cc:152
static const char * sql_mode
Definition: mysqlslap.cc:199
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
const char * table_name
Definition: rules_table_service.cc:56
const char * db_name
Definition: rules_table_service.cc:55
Performance schema instrumentation interface.
required string type
Definition: replication_group_member_actions.proto:34
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
case opt name
Definition: sslopt-case.h:29
Definition: m_ctype.h:423
The current state of the privilege checking process for the current user, SQL statement and SQL objec...
Definition: table.h:368
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3822
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: mysql_lex_string.h:40
const char * str
Definition: mysql_lex_string.h:41
size_t length
Definition: mysql_lex_string.h:42
Definition: mysql_lex_string.h:35
char * str
Definition: mysql_lex_string.h:36
size_t length
Definition: mysql_lex_string.h:37
Definition: my_bitmap.h:43
SP_TABLE represents all instances of one table in an optimized multi-set of tables used by a stored p...
Definition: sp_head.cc:1572
Definition: table.h:1405
Definition: result.h:30
Definition: sp_head.h:151
sp_label * label
Definition: sp_head.h:152
sp_branch_instr * instr
Definition: sp_head.h:153
Definition: sql_lex.h:2554
LEX_CSTRING language
CREATE|ALTER ... LANGUAGE <language>
Definition: sql_lex.h:2559
Definition: sql_lex.h:2564