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