MySQL 8.0.32
Source Code Documentation
sp_instr.h
Go to the documentation of this file.
1/* Copyright (c) 2012, 2022, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef _SP_INSTR_H_
24#define _SP_INSTR_H_
25
26#include <assert.h>
27#include <limits.h>
28#include <string.h>
29#include <sys/types.h>
30
31#include "field_types.h"
32#include "lex_string.h"
33#include "m_string.h"
34#include "my_alloc.h"
35#include "my_compiler.h"
36
37#include "my_inttypes.h"
38#include "my_psi_config.h"
39#include "my_sys.h"
41#include "sql/sql_class.h" // Query_arena
42#include "sql/sql_const.h"
43#include "sql/sql_error.h"
44#include "sql/sql_lex.h"
45#include "sql/sql_list.h"
46#include "sql_string.h"
47
48class Item;
49class Item_case_expr;
52class sp_handler;
53class sp_head;
54class sp_pcontext;
55class sp_variable;
56class Table_ref;
57
58///////////////////////////////////////////////////////////////////////////
59// This file contains SP-instruction classes.
60///////////////////////////////////////////////////////////////////////////
61
62/**
63 sp_printable defines an interface which should be implemented if a class wants
64 report some internal information about its state.
65*/
67 public:
68 virtual void print(const THD *thd, String *str) = 0;
69
70 virtual ~sp_printable() = default;
71};
72
73/**
74 An interface for all SP-instructions with destinations that
75 need to be updated by the SP-optimizer.
76*/
78 public:
79 /**
80 Update the destination; used by the SP-instruction-optimizer.
81
82 @param old_dest current (old) destination (instruction pointer).
83 @param new_dest new destination (instruction pointer).
84 */
85 virtual void set_destination(uint old_dest, uint new_dest) = 0;
86
87 /**
88 Update all instruction with the given label in the backpatch list to
89 the specified instruction pointer.
90
91 @param dest destination instruction pointer.
92 */
93 virtual void backpatch(uint dest) = 0;
94
95 virtual ~sp_branch_instr() = default;
96};
97
98///////////////////////////////////////////////////////////////////////////
99
100/**
101 Base class for every SP-instruction. sp_instr defines interface and provides
102 base implementation.
103*/
104class sp_instr : public sp_printable {
105 public:
107 : m_arena(nullptr, Query_arena::STMT_INITIALIZED_FOR_SP),
108 m_marked(false),
109 m_ip(ip),
110 m_parsing_ctx(ctx) {}
111
112 ~sp_instr() override { m_arena.free_items(); }
113
114 /**
115 Execute this instruction
116
117 @param thd Thread context
118 @param[out] nextp index of the next instruction to execute. (For most
119 instructions this will be the instruction following this
120 one). Note that this parameter is undefined in case of
121 errors, use get_cont_dest() to find the continuation
122 instruction for CONTINUE error handlers.
123
124 @return Error status.
125 */
126 virtual bool execute(THD *thd, uint *nextp) = 0;
127#ifdef HAVE_PSI_INTERFACE
129#endif
130
131 uint get_ip() const { return m_ip; }
132
133 /**
134 Get the continuation destination (instruction pointer for the CONTINUE
135 HANDLER) of this instruction.
136 @return the continuation destination
137 */
138 virtual uint get_cont_dest() const { return get_ip() + 1; }
139
141
142 protected:
143 /**
144 Clear diagnostics area.
145 @param thd Thread context
146 */
147 void clear_da(THD *thd) const {
150 }
151
152 ///////////////////////////////////////////////////////////////////////////
153 // The following operations are used solely for SP-code-optimizer.
154 ///////////////////////////////////////////////////////////////////////////
155
156 public:
157 /**
158 Mark this instruction as reachable during optimization and return the
159 index to the next instruction. Jump instruction will add their
160 destination to the leads list.
161 */
162 virtual uint opt_mark(sp_head *, List<sp_instr> *leads [[maybe_unused]]) {
163 m_marked = true;
164 return get_ip() + 1;
165 }
166
167 /**
168 Short-cut jumps to jumps during optimization. This is used by the
169 jump instructions' opt_mark() methods. 'start' is the starting point,
170 used to prevent the mark sweep from looping for ever. Return the
171 end destination.
172 */
173 virtual uint opt_shortcut_jump(sp_head *, sp_instr *start [[maybe_unused]]) {
174 return get_ip();
175 }
176
177 /**
178 Inform the instruction that it has been moved during optimization.
179 Most instructions will simply update its index, but jump instructions
180 must also take care of their destination pointers. Forward jumps get
181 pushed to the backpatch list 'ibp'.
182 */
183 virtual void opt_move(uint dst, List<sp_branch_instr> *ibp [[maybe_unused]]) {
184 m_ip = dst;
185 }
186
187 bool opt_is_marked() const { return m_marked; }
188
190 return nullptr;
191 }
192
194
195 protected:
196 /// Show if this instruction is reachable within the SP
197 /// (used by SP-optimizer).
199
200 /// Instruction pointer.
202
203 /// Instruction parsing context.
205
206 private:
207 // Prevent use of copy constructor and assignment operator.
210};
211
212///////////////////////////////////////////////////////////////////////////
213
214/**
215 sp_lex_instr is a class providing the interface and base implementation
216 for SP-instructions, whose execution is based on expression evaluation.
217
218 sp_lex_instr keeps LEX-object to be able to evaluate the expression.
219
220 sp_lex_instr also provides possibility to re-parse the original query
221 string if for some reason the LEX-object is not valid any longer.
222*/
223class sp_lex_instr : public sp_instr {
224 public:
225 sp_lex_instr(uint ip, sp_pcontext *ctx, LEX *lex, bool is_lex_owner)
226 : sp_instr(ip, ctx),
227 m_lex(nullptr),
228 m_is_lex_owner(false),
229 m_first_execution(true),
232 set_lex(lex, is_lex_owner);
233 }
234
235 ~sp_lex_instr() override {
236 free_lex();
237 /*
238 If the instruction is reparsed, m_lex_mem_root was used to allocate
239 the items, then freeing the memroot, frees the items. Also free the
240 items allocated on heap as well.
241 */
243 }
244
245 /**
246 Make a few attempts to execute the instruction.
247
248 Basically, this operation does the following things:
249 - install Reprepare_observer to catch metadata changes (if any);
250 - calls reset_lex_and_exec_core() to execute the instruction;
251 - if the execution fails due to a change in metadata, re-parse the
252 instruction's SQL-statement and repeat execution.
253
254 @param thd Thread context.
255 @param[out] nextp Next instruction pointer
256 @param open_tables Flag to specify if the function should check read
257 access to tables in LEX's table list and open and
258 lock them (used in instructions which need to
259 calculate some expression and don't execute
260 complete statement).
261
262 @return Error status.
263 */
265
267 return &m_trig_field_list;
268 }
269
270 private:
271 /**
272 Prepare LEX and thread for execution of instruction, if requested open
273 and lock LEX's tables, execute instruction's core function, perform
274 cleanup afterwards.
275
276 @param thd thread context
277 @param [out] nextp next instruction pointer
278 @param open_tables if true then check read access to tables in LEX's table
279 list and open and lock them (used in instructions which
280 need to calculate some expression and don't execute
281 complete statement).
282
283 @note
284 We are not saving/restoring some parts of THD which may need this because
285 we do this once for whole routine execution in sp_head::execute().
286
287 @return Error status.
288 */
290
291 /**
292 (Re-)parse the query corresponding to this instruction and return a new
293 LEX-object.
294
295 @param thd Thread context.
296 @param sp The stored program.
297
298 @return new LEX-object or NULL in case of failure.
299 */
300 LEX *parse_expr(THD *thd, sp_head *sp);
301
302 /**
303 Set LEX-object.
304
305 Previously assigned LEX-object (if any) will be properly cleaned up
306 and destroyed.
307
308 @param lex LEX-object to be used by this instance of sp_lex_instr.
309 @param is_lex_owner the flag specifying if this instance sp_lex_instr
310 owns (and thus deletes when needed) passed LEX-object.
311 */
312 void set_lex(LEX *lex, bool is_lex_owner);
313
314 /**
315 Cleanup and destroy assigned LEX-object if needed.
316 */
317 void free_lex();
318
319 public:
320 /////////////////////////////////////////////////////////////////////////
321 // sp_instr implementation.
322 /////////////////////////////////////////////////////////////////////////
323
324 bool execute(THD *thd, uint *nextp) override {
325 /*
326 SP instructions with expressions should clear DA before execution.
327 Note that sp_instr_stmt will override execute(), but it clears DA
328 during normal mysql_execute_command().
329 */
330 clear_da(thd);
331 return validate_lex_and_execute_core(thd, nextp, true);
332 }
333
334 protected:
335 /////////////////////////////////////////////////////////////////////////
336 // Interface (virtual) methods.
337 /////////////////////////////////////////////////////////////////////////
338
339 /**
340 Execute core function of instruction after all preparations
341 (e.g. setting of proper LEX, saving part of the thread context).
342
343 @param thd Thread context.
344 @param [out] nextp next instruction pointer
345
346 @return Error flag.
347 */
348 virtual bool exec_core(THD *thd, uint *nextp) = 0;
349
350 /**
351 @retval false if the object (i.e. LEX-object) is valid and exec_core() can
352 be just called.
353
354 @retval true if the object is not valid any longer, exec_core() can not be
355 called. The original query string should be re-parsed and a new LEX-object
356 should be used.
357 */
358 virtual bool is_invalid() const = 0;
359
360 /**
361 Invalidate the object.
362 */
363 virtual void invalidate() = 0;
364
365 /**
366 Return the query string, which can be passed to the parser. I.e. the
367 operation should return a valid SQL-statement query string.
368
369 @param[out] sql_query SQL-statement query string.
370 */
371 virtual void get_query(String *sql_query) const;
372
373 /**
374 Some expressions may be re-parsed as SELECT statements, but need to be
375 adjusted to another SQL command. This function facilitates that change.
376 */
377 virtual void adjust_sql_command(LEX *) {}
378
379 /**
380 @return the expression query string. This string can not be passed directly
381 to the parser as it is most likely not a valid SQL-statement.
382
383 @note as it can be seen in the get_query() implementation, get_expr_query()
384 might return EMPTY_CSTR. EMPTY_CSTR means that no query-expression is
385 available. That happens when class provides different implementation of
386 get_query(). Strictly speaking, this is a drawback of the current class
387 hierarchy.
388 */
389 virtual LEX_CSTRING get_expr_query() const { return EMPTY_CSTR; }
390
391 /**
392 Callback function which is called after the statement query string is
393 successfully parsed, and the thread context has not been switched to the
394 outer context. The thread context contains new LEX-object corresponding to
395 the parsed query string.
396
397 @param thd Thread context.
398
399 @return Error flag.
400 */
401 virtual bool on_after_expr_parsing(THD *thd [[maybe_unused]]) {
402 return false;
403 }
404
405 /**
406 Destroy items in the free list before re-parsing the statement query
407 string (and thus, creating new items).
408
409 @param thd Thread context.
410 */
411 virtual void cleanup_before_parsing(THD *thd);
412
413 /// LEX-object.
415
416 private:
417 /**
418 Mem-root for storing the LEX-tree during reparse. This
419 mem-root is freed when a reparse is triggered or the stored
420 routine is dropped.
421 */
423
424 /**
425 Indicates whether this sp_lex_instr instance is responsible for
426 LEX-object deletion.
427 */
429
430 /**
431 Indicates whether exec_core() has not been already called on the current
432 LEX-object.
433 */
435
436 /*****************************************************************************
437 Support for being able to execute this statement in two modes:
438 a) inside prelocked mode set by the calling procedure or its ancestor.
439 b) outside of prelocked mode, when this statement enters/leaves
440 prelocked mode itself.
441 *****************************************************************************/
442
443 /**
444 List of additional tables this statement needs to lock when it
445 enters/leaves prelocked mode on its own.
446 */
448
449 /**
450 The value m_lex->query_tables_own_last should be set to this when the
451 statement enters/leaves prelocked mode on its own.
452 */
454
455 /**
456 List of all the Item_trigger_field's of instruction.
457 */
459};
460
461///////////////////////////////////////////////////////////////////////////
462
463/**
464 sp_instr_stmt represents almost all conventional SQL-statements, which are
465 supported outside stored programs.
466
467 SET-statements, which deal with SP-variable or NEW/OLD trigger pseudo-rows are
468 not represented by this instruction.
469*/
471 public:
473 : sp_lex_instr(ip, lex->get_sp_current_parsing_ctx(), lex, true),
474 m_query(query),
475 m_valid(true) {}
476
477 /////////////////////////////////////////////////////////////////////////
478 // sp_instr implementation.
479 /////////////////////////////////////////////////////////////////////////
480
481 bool execute(THD *thd, uint *nextp) override;
482
483 /////////////////////////////////////////////////////////////////////////
484 // sp_printable implementation.
485 /////////////////////////////////////////////////////////////////////////
486
487 void print(const THD *thd, String *str) override;
488
489 /////////////////////////////////////////////////////////////////////////
490 // sp_lex_instr implementation.
491 /////////////////////////////////////////////////////////////////////////
492
493 bool exec_core(THD *thd, uint *nextp) override;
494
495 bool is_invalid() const override { return !m_valid; }
496
497 void invalidate() override { m_valid = false; }
498
499 void get_query(String *sql_query) const override {
500 sql_query->append(m_query.str, m_query.length);
501 }
502
503 bool on_after_expr_parsing(THD *) override {
504 m_valid = true;
505 return false;
506 }
507
508 private:
509 /// Complete query of the SQL-statement.
511
512 /// Specify if the stored LEX-object is up-to-date.
514
515#ifdef HAVE_PSI_INTERFACE
516 public:
517 PSI_statement_info *get_psi_info() override { return &psi_info; }
518
520#endif
521};
522
523///////////////////////////////////////////////////////////////////////////
524
525/**
526 sp_instr_set represents SET-statements, which deal with SP-variables.
527*/
529 public:
530 sp_instr_set(uint ip, LEX *lex, uint offset, Item *value_item,
531 LEX_CSTRING value_query, bool is_lex_owner)
532 : sp_lex_instr(ip, lex->get_sp_current_parsing_ctx(), lex, is_lex_owner),
533 m_offset(offset),
534 m_value_item(value_item),
535 m_value_query(value_query) {}
536
537 /////////////////////////////////////////////////////////////////////////
538 // sp_printable implementation.
539 /////////////////////////////////////////////////////////////////////////
540
541 void print(const THD *thd, String *str) override;
542
543 /////////////////////////////////////////////////////////////////////////
544 // sp_lex_instr implementation.
545 /////////////////////////////////////////////////////////////////////////
546
547 bool exec_core(THD *thd, uint *nextp) override;
548
549 bool is_invalid() const override { return m_value_item == nullptr; }
550
551 void invalidate() override { m_value_item = nullptr; }
552
553 bool on_after_expr_parsing(THD *thd) override {
555 assert(m_value_item != nullptr);
556
557 return false;
558 }
559
560 LEX_CSTRING get_expr_query() const override { return m_value_query; }
561
562 void adjust_sql_command(LEX *lex) override {
563 assert(lex->sql_command == SQLCOM_SELECT);
565 }
566
567 private:
568 /// Frame offset.
570
571 /// Value expression item of the SET-statement.
573
574 /// SQL-query corresponding to the value expression.
576
577#ifdef HAVE_PSI_INTERFACE
578 public:
580 PSI_statement_info *get_psi_info() override { return &psi_info; }
581#endif
582};
583
584///////////////////////////////////////////////////////////////////////////
585
586/**
587 sp_instr_set_trigger_field represents SET-statements, which deal with NEW/OLD
588 trigger pseudo-rows.
589*/
591 public:
592 sp_instr_set_trigger_field(uint ip, LEX *lex, LEX_CSTRING trigger_field_name,
593 Item_trigger_field *trigger_field,
594 Item *value_item, LEX_CSTRING value_query)
595 : sp_lex_instr(ip, lex->get_sp_current_parsing_ctx(), lex, true),
596 m_trigger_field_name(trigger_field_name),
597 m_trigger_field(trigger_field),
598 m_value_item(value_item),
599 m_value_query(value_query) {}
600
601 /////////////////////////////////////////////////////////////////////////
602 // sp_printable implementation.
603 /////////////////////////////////////////////////////////////////////////
604
605 void print(const THD *thd, String *str) override;
606
607 /////////////////////////////////////////////////////////////////////////
608 // sp_lex_instr implementation.
609 /////////////////////////////////////////////////////////////////////////
610
611 bool exec_core(THD *thd, uint *nextp) override;
612
613 bool is_invalid() const override { return m_value_item == nullptr; }
614
615 void invalidate() override { m_value_item = nullptr; }
616
617 bool on_after_expr_parsing(THD *thd) override;
618
619 void cleanup_before_parsing(THD *thd) override;
620
621 LEX_CSTRING get_expr_query() const override { return m_value_query; }
622
623 private:
624 /// Trigger field name ("field_name" of the "NEW.field_name").
626
627 /// Item corresponding to the NEW/OLD trigger field.
629
630 /// Value expression item of the SET-statement.
632
633 /// SQL-query corresponding to the value expression.
635
636#ifdef HAVE_PSI_INTERFACE
637 public:
638 PSI_statement_info *get_psi_info() override { return &psi_info; }
639
641#endif
642};
643
644///////////////////////////////////////////////////////////////////////////
645
646/**
647 sp_instr_freturn represents RETURN statement in stored functions.
648*/
650 public:
651 sp_instr_freturn(uint ip, LEX *lex, Item *expr_item, LEX_CSTRING expr_query,
652 enum enum_field_types return_field_type)
653 : sp_lex_instr(ip, lex->get_sp_current_parsing_ctx(), lex, true),
654 m_expr_item(expr_item),
655 m_expr_query(expr_query),
656 m_return_field_type(return_field_type) {}
657
658 /////////////////////////////////////////////////////////////////////////
659 // sp_printable implementation.
660 /////////////////////////////////////////////////////////////////////////
661
662 void print(const THD *thd, String *str) override;
663
664 /////////////////////////////////////////////////////////////////////////
665 // sp_instr implementation.
666 /////////////////////////////////////////////////////////////////////////
667
669 m_marked = true;
670 return UINT_MAX;
671 }
672
673 /////////////////////////////////////////////////////////////////////////
674 // sp_lex_instr implementation.
675 /////////////////////////////////////////////////////////////////////////
676
677 bool exec_core(THD *thd, uint *nextp) override;
678
679 bool is_invalid() const override { return m_expr_item == nullptr; }
680
681 void invalidate() override {
682 // it's already deleted.
683 m_expr_item = nullptr;
684 }
685
686 bool on_after_expr_parsing(THD *thd) override {
688 assert(m_expr_item != nullptr);
689 return false;
690 }
691
692 LEX_CSTRING get_expr_query() const override { return m_expr_query; }
693
694 private:
695 /// RETURN-expression item.
697
698 /// SQL-query corresponding to the RETURN-expression.
700
701 /// RETURN-field type code.
703
704#ifdef HAVE_PSI_INTERFACE
705 public:
706 PSI_statement_info *get_psi_info() override { return &psi_info; }
707
709#endif
710};
711
712///////////////////////////////////////////////////////////////////////////
713
714/**
715 This is base class for all kinds of jump instructions.
716
717 @note this is the only class, we directly construct instances of, that has
718 subclasses. We also redefine sp_instr_jump behavior in those subclasses.
719
720 @todo later we will consider introducing a new class, which will be the base
721 for sp_instr_jump, sp_instr_set_case_expr and sp_instr_jump_case_when.
722 Something like sp_regular_branch_instr (similar to sp_lex_branch_instr).
723*/
724class sp_instr_jump : public sp_instr, public sp_branch_instr {
725 public:
727 : sp_instr(ip, ctx), m_dest(0), m_optdest(nullptr) {}
728
730 : sp_instr(ip, ctx), m_dest(dest), m_optdest(nullptr) {}
731
732 /////////////////////////////////////////////////////////////////////////
733 // sp_printable implementation.
734 /////////////////////////////////////////////////////////////////////////
735
736 void print(const THD *thd, String *str) override;
737
738 /////////////////////////////////////////////////////////////////////////
739 // sp_instr implementation.
740 /////////////////////////////////////////////////////////////////////////
741
742 bool execute(THD *, uint *nextp) override {
743 *nextp = m_dest;
744 return false;
745 }
746
747 uint opt_mark(sp_head *sp, List<sp_instr> *leads) override;
748
750
751 void opt_move(uint dst, List<sp_branch_instr> *ibp) override;
752
753 /////////////////////////////////////////////////////////////////////////
754 // sp_branch_instr implementation.
755 /////////////////////////////////////////////////////////////////////////
756
757 void set_destination(uint old_dest, uint new_dest) override {
758 if (m_dest == old_dest) m_dest = new_dest;
759 }
760
761 void backpatch(uint dest) override {
762 /* Calling backpatch twice is a logic flaw in jump resolution. */
763 assert(m_dest == 0);
764 m_dest = dest;
765 }
766
767 protected:
768 /// Where we will go.
770
771 // The following attribute is used by SP-optimizer.
773
774#ifdef HAVE_PSI_INTERFACE
775 public:
776 PSI_statement_info *get_psi_info() override { return &psi_info; }
777
779#endif
780};
781
782///////////////////////////////////////////////////////////////////////////
783
784/**
785 sp_lex_branch_instr is a base class for SP-instructions, which might perform
786 conditional jump depending on the value of an SQL-expression.
787*/
789 protected:
790 sp_lex_branch_instr(uint ip, sp_pcontext *ctx, LEX *lex, Item *expr_item,
791 LEX_CSTRING expr_query)
792 : sp_lex_instr(ip, ctx, lex, true),
793 m_dest(0),
794 m_cont_dest(0),
797 m_expr_item(expr_item),
798 m_expr_query(expr_query) {}
799
800 sp_lex_branch_instr(uint ip, sp_pcontext *ctx, LEX *lex, Item *expr_item,
801 LEX_CSTRING expr_query, uint dest)
802 : sp_lex_instr(ip, ctx, lex, true),
803 m_dest(dest),
804 m_cont_dest(0),
807 m_expr_item(expr_item),
808 m_expr_query(expr_query) {}
809
810 public:
811 void set_cont_dest(uint cont_dest) { m_cont_dest = cont_dest; }
812
813 /////////////////////////////////////////////////////////////////////////
814 // sp_instr implementation.
815 /////////////////////////////////////////////////////////////////////////
816
817 uint opt_mark(sp_head *sp, List<sp_instr> *leads) override;
818
819 void opt_move(uint dst, List<sp_branch_instr> *ibp) override;
820
821 uint get_cont_dest() const override { return m_cont_dest; }
822
823 /////////////////////////////////////////////////////////////////////////
824 // sp_lex_instr implementation.
825 /////////////////////////////////////////////////////////////////////////
826
827 bool is_invalid() const override { return m_expr_item == nullptr; }
828
829 void invalidate() override {
830 m_expr_item = nullptr; /* it's already deleted. */
831 }
832
833 LEX_CSTRING get_expr_query() const override { return m_expr_query; }
834
835 /////////////////////////////////////////////////////////////////////////
836 // sp_branch_instr implementation.
837 /////////////////////////////////////////////////////////////////////////
838
839 void set_destination(uint old_dest, uint new_dest) override {
840 if (m_dest == old_dest) m_dest = new_dest;
841
842 if (m_cont_dest == old_dest) m_cont_dest = new_dest;
843 }
844
845 void backpatch(uint dest) override {
846 /* Calling backpatch twice is a logic flaw in jump resolution. */
847 assert(m_dest == 0);
848 m_dest = dest;
849 }
850
851 void adjust_sql_command(LEX *lex) override {
852 assert(lex->sql_command == SQLCOM_SELECT);
853 lex->sql_command = SQLCOM_END;
854 }
855
856 protected:
857 /// Where we will go.
859
860 /// Where continue handlers will go.
862
863 // The following attributes are used by SP-optimizer.
866
867 /// Expression item.
869
870 /// SQL-query corresponding to the expression.
872};
873
874///////////////////////////////////////////////////////////////////////////
875
876/**
877 sp_instr_jump_if_not implements SP-instruction, which does the jump if its
878 SQL-expression is false.
879*/
881 public:
882 sp_instr_jump_if_not(uint ip, LEX *lex, Item *expr_item,
883 LEX_CSTRING expr_query)
884 : sp_lex_branch_instr(ip, lex->get_sp_current_parsing_ctx(), lex,
885 expr_item, expr_query) {}
886
887 sp_instr_jump_if_not(uint ip, LEX *lex, Item *expr_item,
888 LEX_CSTRING expr_query, uint dest)
889 : sp_lex_branch_instr(ip, lex->get_sp_current_parsing_ctx(), lex,
890 expr_item, expr_query, dest) {}
891
892 /////////////////////////////////////////////////////////////////////////
893 // sp_printable implementation.
894 /////////////////////////////////////////////////////////////////////////
895
896 void print(const THD *thd, String *str) override;
897
898 /////////////////////////////////////////////////////////////////////////
899 // sp_lex_instr implementation.
900 /////////////////////////////////////////////////////////////////////////
901
902 bool exec_core(THD *thd, uint *nextp) override;
903
904 bool on_after_expr_parsing(THD *thd) override {
906 assert(m_expr_item != nullptr);
907 return false;
908 }
909
910#ifdef HAVE_PSI_INTERFACE
911 public:
912 PSI_statement_info *get_psi_info() override { return &psi_info; }
913
915#endif
916};
917
918///////////////////////////////////////////////////////////////////////////
919// Instructions used for the "simple CASE" implementation.
920///////////////////////////////////////////////////////////////////////////
921
922/**
923 sp_instr_set_case_expr is used in the "simple CASE" implementation to evaluate
924 and store the CASE-expression in the runtime context.
925*/
927 public:
928 sp_instr_set_case_expr(uint ip, LEX *lex, uint case_expr_id,
929 Item *case_expr_item, LEX_CSTRING case_expr_query)
930 : sp_lex_branch_instr(ip, lex->get_sp_current_parsing_ctx(), lex,
931 case_expr_item, case_expr_query),
932 m_case_expr_id(case_expr_id) {}
933
934 /////////////////////////////////////////////////////////////////////////
935 // sp_printable implementation.
936 /////////////////////////////////////////////////////////////////////////
937
938 void print(const THD *thd, String *str) override;
939
940 /////////////////////////////////////////////////////////////////////////
941 // sp_instr implementation.
942 /////////////////////////////////////////////////////////////////////////
943
944 uint opt_mark(sp_head *sp, List<sp_instr> *leads) override;
945
946 void opt_move(uint dst, List<sp_branch_instr> *ibp) override;
947
948 /////////////////////////////////////////////////////////////////////////
949 // sp_branch_instr implementation.
950 /////////////////////////////////////////////////////////////////////////
951
952 /*
953 NOTE: set_destination() and backpatch() are overridden here just because the
954 m_dest attribute is not used by this class, so there is no need to do
955 anything about it.
956
957 @todo These operations probably should be left as they are (i.e. do not
958 override them here). The m_dest attribute would be set and not used, but
959 that should not be a big deal.
960
961 @todo This also indicates deficiency of the current SP-istruction class
962 hierarchy.
963 */
964
965 void set_destination(uint old_dest, uint new_dest) override {
966 if (m_cont_dest == old_dest) m_cont_dest = new_dest;
967 }
968
969 void backpatch(uint) override {}
970
971 /////////////////////////////////////////////////////////////////////////
972 // sp_lex_instr implementation.
973 /////////////////////////////////////////////////////////////////////////
974
975 bool exec_core(THD *thd, uint *nextp) override;
976
977 bool on_after_expr_parsing(THD *thd) override {
979 assert(m_expr_item != nullptr);
980 return false;
981 }
982
983 private:
984 /// Identifier (index) of the CASE-expression in the runtime context.
986
987#ifdef HAVE_PSI_INTERFACE
988 public:
989 PSI_statement_info *get_psi_info() override { return &psi_info; }
990
992#endif
993};
994
995///////////////////////////////////////////////////////////////////////////
996
997/**
998 sp_instr_jump_case_when instruction is used in the "simple CASE"
999 implementation. It's a jump instruction with the following condition:
1000 (CASE-expression = WHEN-expression)
1001 CASE-expression is retrieved from sp_rcontext;
1002 WHEN-expression is kept by this instruction.
1003*/
1005 public:
1006 sp_instr_jump_case_when(uint ip, LEX *lex, int case_expr_id,
1007 Item *when_expr_item, LEX_CSTRING when_expr_query)
1008 : sp_lex_branch_instr(ip, lex->get_sp_current_parsing_ctx(), lex,
1009 when_expr_item, when_expr_query),
1010 m_case_expr_id(case_expr_id) {}
1011
1012 /////////////////////////////////////////////////////////////////////////
1013 // sp_printable implementation.
1014 /////////////////////////////////////////////////////////////////////////
1015
1016 void print(const THD *thd, String *str) override;
1017
1018 /////////////////////////////////////////////////////////////////////////
1019 // sp_lex_instr implementation.
1020 /////////////////////////////////////////////////////////////////////////
1021
1022 bool exec_core(THD *thd, uint *nextp) override;
1023
1024 void invalidate() override {
1025 // Items should be already deleted in lex-keeper.
1026 m_case_expr_item = nullptr;
1027 m_eq_item = nullptr;
1028 m_expr_item = nullptr; // it's a WHEN-expression.
1029 }
1030
1031 /**
1032 Build CASE-expression item tree:
1033 Item_func_eq(case-expression, when-i-expression)
1034
1035 This function is used for the following form of CASE statement:
1036 CASE case-expression
1037 WHEN when-1-expression THEN ...
1038 WHEN when-2-expression THEN ...
1039 ...
1040 WHEN when-n-expression THEN ...
1041 END CASE
1042
1043 The thing is that after the parsing we have an item (item tree) for the
1044 case-expression and for each when-expression. Here we build jump
1045 conditions: expressions like (case-expression = when-i-expression).
1046
1047 @param thd Thread context.
1048
1049 @return Error flag.
1050 */
1051 bool on_after_expr_parsing(THD *thd) override;
1052
1053 private:
1054 /// Identifier (index) of the CASE-expression in the runtime context.
1056
1057 /// Item representing the CASE-expression.
1059
1060 /**
1061 Item corresponding to the main item of the jump-condition-expression:
1062 it's the equal function (=) in the (case-expression = when-i-expression)
1063 expression.
1064 */
1066
1067#ifdef HAVE_PSI_INTERFACE
1068 public:
1070
1072#endif
1073};
1074
1075///////////////////////////////////////////////////////////////////////////
1076// SQL-condition handler instructions.
1077///////////////////////////////////////////////////////////////////////////
1078
1080 public:
1082
1083 ~sp_instr_hpush_jump() override;
1084
1085 void add_condition(sp_condition_value *condition_value);
1086
1088
1089 /////////////////////////////////////////////////////////////////////////
1090 // sp_printable implementation.
1091 /////////////////////////////////////////////////////////////////////////
1092
1093 void print(const THD *thd, String *str) override;
1094
1095 /////////////////////////////////////////////////////////////////////////
1096 // sp_instr implementation.
1097 /////////////////////////////////////////////////////////////////////////
1098
1099 bool execute(THD *thd, uint *nextp) override;
1100
1101 uint opt_mark(sp_head *sp, List<sp_instr> *leads) override;
1102
1103 /** Override sp_instr_jump's shortcut; we stop here. */
1104 uint opt_shortcut_jump(sp_head *, sp_instr *) override { return get_ip(); }
1105
1106 /////////////////////////////////////////////////////////////////////////
1107 // sp_branch_instr implementation.
1108 /////////////////////////////////////////////////////////////////////////
1109
1110 void backpatch(uint dest) override {
1111 assert(!m_dest || !m_opt_hpop);
1112 if (!m_dest)
1113 m_dest = dest;
1114 else
1115 m_opt_hpop = dest;
1116 }
1117
1118 private:
1119 /// Handler.
1121
1122 /// hpop marking end of handler scope.
1124
1125 // This attribute is needed for SHOW PROCEDURE CODE only (i.e. it's needed in
1126 // debug version only). It's used in print().
1128
1129#ifdef HAVE_PSI_INTERFACE
1130 public:
1132
1134#endif
1135};
1136
1137///////////////////////////////////////////////////////////////////////////
1138
1139class sp_instr_hpop : public sp_instr {
1140 public:
1141 sp_instr_hpop(uint ip, sp_pcontext *ctx) : sp_instr(ip, ctx) {}
1142
1143 /////////////////////////////////////////////////////////////////////////
1144 // sp_printable implementation.
1145 /////////////////////////////////////////////////////////////////////////
1146
1147 void print(const THD *, String *str) override {
1148 str->append(STRING_WITH_LEN("hpop"));
1149 }
1150
1151 /////////////////////////////////////////////////////////////////////////
1152 // sp_instr implementation.
1153 /////////////////////////////////////////////////////////////////////////
1154
1155 bool execute(THD *thd, uint *nextp) override;
1156
1157#ifdef HAVE_PSI_INTERFACE
1158 public:
1160
1162#endif
1163};
1164
1165///////////////////////////////////////////////////////////////////////////
1166
1168 public:
1170
1171 /////////////////////////////////////////////////////////////////////////
1172 // sp_printable implementation.
1173 /////////////////////////////////////////////////////////////////////////
1174
1175 void print(const THD *thd, String *str) override;
1176
1177 /////////////////////////////////////////////////////////////////////////
1178 // sp_instr implementation.
1179 /////////////////////////////////////////////////////////////////////////
1180
1181 bool execute(THD *thd, uint *nextp) override;
1182
1183 /** Override sp_instr_jump's shortcut; we stop here. */
1184 uint opt_shortcut_jump(sp_head *, sp_instr *) override { return get_ip(); }
1185
1186 uint opt_mark(sp_head *sp, List<sp_instr> *leads) override;
1187
1188 private:
1189 // This attribute is needed for SHOW PROCEDURE CODE only (i.e. it's needed in
1190 // debug version only). It's used in print().
1192
1193#ifdef HAVE_PSI_INTERFACE
1194 public:
1196
1198#endif
1199};
1200
1201///////////////////////////////////////////////////////////////////////////
1202// Cursor implementation.
1203///////////////////////////////////////////////////////////////////////////
1204
1205/**
1206 sp_instr_cpush corresponds to DECLARE CURSOR, implements DECLARE CURSOR and
1207 OPEN.
1208
1209 This is the most important instruction in cursor implementation. It is created
1210 and added to sp_head when DECLARE CURSOR is being parsed. The arena of this
1211 instruction contains LEX-object for the cursor's SELECT-statement.
1212
1213 This instruction is actually used to open the cursor.
1214
1215 execute() operation "implements" DECLARE CURSOR statement -- it merely pushes
1216 a new cursor object into the stack in sp_rcontext object.
1217
1218 exec_core() operation implements OPEN statement. It is important to implement
1219 OPEN statement in this instruction, because OPEN may lead to re-parsing of the
1220 SELECT-statement. So, the original Arena and parsing context must be used.
1221*/
1223 public:
1224 sp_instr_cpush(uint ip, sp_pcontext *ctx, LEX *cursor_lex,
1225 LEX_CSTRING cursor_query, int cursor_idx)
1226 : sp_lex_instr(ip, ctx, cursor_lex, true),
1227 m_cursor_query(cursor_query),
1228 m_valid(true),
1229 m_cursor_idx(cursor_idx) {
1230 /*
1231 Cursors cause queries to depend on external state, so they are
1232 noncacheable.
1233 */
1234 cursor_lex->safe_to_cache_query = false;
1235 }
1236
1237 /////////////////////////////////////////////////////////////////////////
1238 // sp_printable implementation.
1239 /////////////////////////////////////////////////////////////////////////
1240
1241 void print(const THD *thd, String *str) override;
1242
1243 /////////////////////////////////////////////////////////////////////////
1244 // sp_instr implementation.
1245 /////////////////////////////////////////////////////////////////////////
1246
1247 bool execute(THD *thd, uint *nextp) override;
1248
1249 /////////////////////////////////////////////////////////////////////////
1250 // sp_lex_instr implementation.
1251 /////////////////////////////////////////////////////////////////////////
1252
1253 bool exec_core(THD *thd, uint *nextp) override;
1254
1255 bool is_invalid() const override { return !m_valid; }
1256
1257 void invalidate() override { m_valid = false; }
1258
1259 void get_query(String *sql_query) const override {
1261 }
1262
1263 bool on_after_expr_parsing(THD *) override {
1264 m_valid = true;
1265 return false;
1266 }
1267
1268 private:
1269 /// This attribute keeps the cursor SELECT statement.
1271
1272 /// Flag if the LEX-object of this instruction is valid or not.
1273 /// The LEX-object is not valid when metadata have changed.
1275
1276 /// Used to identify the cursor in the sp_rcontext.
1278
1279#ifdef HAVE_PSI_INTERFACE
1280 public:
1282
1284#endif
1285};
1286
1287///////////////////////////////////////////////////////////////////////////
1288
1289/**
1290 sp_instr_cpop instruction is added at the end of BEGIN..END block.
1291 It's used to remove declared cursors so that they are not visible any longer.
1292*/
1293class sp_instr_cpop : public sp_instr {
1294 public:
1296 : sp_instr(ip, ctx), m_count(count) {}
1297
1298 /////////////////////////////////////////////////////////////////////////
1299 // sp_printable implementation.
1300 /////////////////////////////////////////////////////////////////////////
1301
1302 void print(const THD *thd, String *str) override;
1303
1304 /////////////////////////////////////////////////////////////////////////
1305 // sp_instr implementation.
1306 /////////////////////////////////////////////////////////////////////////
1307
1308 bool execute(THD *thd, uint *nextp) override;
1309
1310 private:
1312
1313#ifdef HAVE_PSI_INTERFACE
1314 public:
1316
1318#endif
1319};
1320
1321///////////////////////////////////////////////////////////////////////////
1322
1323/**
1324 sp_instr_copen represents OPEN statement (opens the cursor).
1325 However, the actual implementation is in sp_instr_cpush::exec_core().
1326*/
1327class sp_instr_copen : public sp_instr {
1328 public:
1329 sp_instr_copen(uint ip, sp_pcontext *ctx, int cursor_idx)
1330 : sp_instr(ip, ctx), m_cursor_idx(cursor_idx) {}
1331
1332 /////////////////////////////////////////////////////////////////////////
1333 // sp_printable implementation.
1334 /////////////////////////////////////////////////////////////////////////
1335
1336 void print(const THD *thd, String *str) override;
1337
1338 /////////////////////////////////////////////////////////////////////////
1339 // sp_instr implementation.
1340 /////////////////////////////////////////////////////////////////////////
1341
1342 bool execute(THD *thd, uint *nextp) override;
1343
1344 private:
1345 /// Used to identify the cursor in the sp_rcontext.
1347
1348#ifdef HAVE_PSI_INTERFACE
1349 public:
1351
1353#endif
1354};
1355
1356///////////////////////////////////////////////////////////////////////////
1357
1358/**
1359 The instruction corresponds to the CLOSE statement.
1360 It just forwards the close-call to the appropriate sp_cursor object in the
1361 sp_rcontext.
1362*/
1364 public:
1365 sp_instr_cclose(uint ip, sp_pcontext *ctx, int cursor_idx)
1366 : sp_instr(ip, ctx), m_cursor_idx(cursor_idx) {}
1367
1368 /////////////////////////////////////////////////////////////////////////
1369 // sp_printable implementation.
1370 /////////////////////////////////////////////////////////////////////////
1371
1372 void print(const THD *thd, String *str) override;
1373
1374 /////////////////////////////////////////////////////////////////////////
1375 // sp_instr implementation.
1376 /////////////////////////////////////////////////////////////////////////
1377
1378 bool execute(THD *thd, uint *nextp) override;
1379
1380 private:
1381 /// Used to identify the cursor in the sp_rcontext.
1383
1384#ifdef HAVE_PSI_INTERFACE
1385 public:
1387
1389#endif
1390};
1391
1392///////////////////////////////////////////////////////////////////////////
1393
1394/**
1395 The instruction corresponds to the FETCH statement.
1396 It just forwards the close-call to the appropriate sp_cursor object in the
1397 sp_rcontext.
1398*/
1400 public:
1401 sp_instr_cfetch(uint ip, sp_pcontext *ctx, int cursor_idx)
1402 : sp_instr(ip, ctx), m_cursor_idx(cursor_idx) {}
1403
1404 /////////////////////////////////////////////////////////////////////////
1405 // sp_printable implementation.
1406 /////////////////////////////////////////////////////////////////////////
1407
1408 void print(const THD *thd, String *str) override;
1409
1410 /////////////////////////////////////////////////////////////////////////
1411 // sp_instr implementation.
1412 /////////////////////////////////////////////////////////////////////////
1413
1414 bool execute(THD *thd, uint *nextp) override;
1415
1416 void add_to_varlist(sp_variable *var) { m_varlist.push_back(var); }
1417
1418 private:
1419 /// List of SP-variables to store fetched values.
1421
1422 /// Used to identify the cursor in the sp_rcontext.
1424
1425#ifdef HAVE_PSI_INTERFACE
1426 public:
1428
1430#endif
1431};
1432
1433///////////////////////////////////////////////////////////////////////////
1434///////////////////////////////////////////////////////////////////////////
1435
1436/**
1437 sp_instr_error just throws an SQL-condition if the execution flow comes to it.
1438 It's used in the CASE implementation to perform runtime-check that the
1439 CASE-expression is handled by some WHEN/ELSE clause.
1440*/
1441class sp_instr_error : public sp_instr {
1442 public:
1443 sp_instr_error(uint ip, sp_pcontext *ctx, int errcode)
1444 : sp_instr(ip, ctx), m_errcode(errcode) {}
1445
1446 /////////////////////////////////////////////////////////////////////////
1447 // sp_printable implementation.
1448 /////////////////////////////////////////////////////////////////////////
1449
1450 void print(const THD *thd, String *str) override;
1451
1452 /////////////////////////////////////////////////////////////////////////
1453 // sp_instr implementation.
1454 /////////////////////////////////////////////////////////////////////////
1455
1456 bool execute(THD *, uint *nextp) override {
1457 my_error(m_errcode, MYF(0));
1458 *nextp = get_ip() + 1;
1459 return true;
1460 }
1461
1463 m_marked = true;
1464 return UINT_MAX;
1465 }
1466
1467 private:
1468 /// The error code, which should be raised by this instruction.
1470
1471#ifdef HAVE_PSI_INTERFACE
1472 public:
1474
1476#endif
1477};
1478
1479///////////////////////////////////////////////////////////////////////////
1480
1481#endif // _SP_INSTR_H_
static app_data_list nextp(app_data_list l)
Return next element in list of app_data.
Definition: app_data.cc:300
void reset_condition_info(THD *thd)
Reset the current condition information stored in the Diagnostics Area.
Definition: sql_error.cc:479
void reset_diagnostics_area()
Clear this Diagnostics Area.
Definition: sql_error.cc:354
Definition: item.h:3718
Represents NEW/OLD version of field of row which is changed/read in trigger.
Definition: item.h:6486
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:850
Definition: sql_list.h:433
Definition: sql_class.h:342
void free_items()
Definition: sql_class.cc:2005
enum_sql_command sql_command
SQL command for this statement.
Definition: sql_lex.h:2500
Simple intrusive linked list.
Definition: sql_list.h:45
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
bool append(const String &s)
Definition: sql_string.cc:445
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
LEX * lex
Definition: sql_class.h:995
Diagnostics_area * get_stmt_da()
Returns first Diagnostics Area for the current statement.
Definition: sql_class.h:3222
Definition: table.h:2755
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4354
An interface for all SP-instructions with destinations that need to be updated by the SP-optimizer.
Definition: sp_instr.h:77
virtual void backpatch(uint dest)=0
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
virtual ~sp_branch_instr()=default
virtual void set_destination(uint old_dest, uint new_dest)=0
Update the destination; used by the SP-instruction-optimizer.
This class represents condition-value term in DECLARE CONDITION or DECLARE HANDLER statements.
Definition: sp_pcontext.h:132
This class represents 'DECLARE HANDLER' statement.
Definition: sp_pcontext.h:192
sp_head represents one instance of a stored program.
Definition: sp_head.h:379
The instruction corresponds to the CLOSE statement.
Definition: sp_instr.h:1363
static PSI_statement_info psi_info
Definition: sp_instr.h:1388
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1614
sp_instr_cclose(uint ip, sp_pcontext *ctx, int cursor_idx)
Definition: sp_instr.h:1365
int m_cursor_idx
Used to identify the cursor in the sp_rcontext.
Definition: sp_instr.h:1382
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1625
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1386
The instruction corresponds to the FETCH statement.
Definition: sp_instr.h:1399
List< sp_variable > m_varlist
List of SP-variables to store fetched values.
Definition: sp_instr.h:1420
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1427
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1650
sp_instr_cfetch(uint ip, sp_pcontext *ctx, int cursor_idx)
Definition: sp_instr.h:1401
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1661
static PSI_statement_info psi_info
Definition: sp_instr.h:1429
void add_to_varlist(sp_variable *var)
Definition: sp_instr.h:1416
int m_cursor_idx
Used to identify the cursor in the sp_rcontext.
Definition: sp_instr.h:1423
sp_instr_copen represents OPEN statement (opens the cursor).
Definition: sp_instr.h:1327
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1548
sp_instr_copen(uint ip, sp_pcontext *ctx, int cursor_idx)
Definition: sp_instr.h:1329
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1589
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1350
static PSI_statement_info psi_info
Definition: sp_instr.h:1352
int m_cursor_idx
Used to identify the cursor in the sp_rcontext.
Definition: sp_instr.h:1346
sp_instr_cpop instruction is added at the end of BEGIN..END block.
Definition: sp_instr.h:1293
uint m_count
Definition: sp_instr.h:1311
static PSI_statement_info psi_info
Definition: sp_instr.h:1317
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1315
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1533
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1526
sp_instr_cpop(uint ip, sp_pcontext *ctx, uint count)
Definition: sp_instr.h:1295
sp_instr_cpush corresponds to DECLARE CURSOR, implements DECLARE CURSOR and OPEN.
Definition: sp_instr.h:1222
bool is_invalid() const override
Definition: sp_instr.h:1255
bool on_after_expr_parsing(THD *) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:1263
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:1257
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1281
static PSI_statement_info psi_info
Definition: sp_instr.h:1283
int m_cursor_idx
Used to identify the cursor in the sp_rcontext.
Definition: sp_instr.h:1277
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1483
void get_query(String *sql_query) const override
Return the query string, which can be passed to the parser.
Definition: sp_instr.h:1259
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1500
LEX_CSTRING m_cursor_query
This attribute keeps the cursor SELECT statement.
Definition: sp_instr.h:1270
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1491
bool m_valid
Flag if the LEX-object of this instruction is valid or not.
Definition: sp_instr.h:1274
sp_instr_cpush(uint ip, sp_pcontext *ctx, LEX *cursor_lex, LEX_CSTRING cursor_query, int cursor_idx)
Definition: sp_instr.h:1224
sp_instr_error just throws an SQL-condition if the execution flow comes to it.
Definition: sp_instr.h:1441
bool execute(THD *, uint *nextp) override
Execute this instruction.
Definition: sp_instr.h:1456
sp_instr_error(uint ip, sp_pcontext *ctx, int errcode)
Definition: sp_instr.h:1443
int m_errcode
The error code, which should be raised by this instruction.
Definition: sp_instr.h:1469
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1473
uint opt_mark(sp_head *, List< sp_instr > *) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.h:1462
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1694
static PSI_statement_info psi_info
Definition: sp_instr.h:1475
sp_instr_freturn represents RETURN statement in stored functions.
Definition: sp_instr.h:649
LEX_CSTRING m_expr_query
SQL-query corresponding to the RETURN-expression.
Definition: sp_instr.h:699
static PSI_statement_info psi_info
Definition: sp_instr.h:708
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:681
Item * m_expr_item
RETURN-expression item.
Definition: sp_instr.h:696
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1293
LEX_CSTRING get_expr_query() const override
Definition: sp_instr.h:692
enum enum_field_types m_return_field_type
RETURN-field type code.
Definition: sp_instr.h:702
sp_instr_freturn(uint ip, LEX *lex, Item *expr_item, LEX_CSTRING expr_query, enum enum_field_types return_field_type)
Definition: sp_instr.h:651
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:686
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:706
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1312
bool is_invalid() const override
Definition: sp_instr.h:679
uint opt_mark(sp_head *, List< sp_instr > *) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.h:668
Definition: sp_instr.h:1139
void print(const THD *, String *str) override
Definition: sp_instr.h:1147
static PSI_statement_info psi_info
Definition: sp_instr.h:1161
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1159
sp_instr_hpop(uint ip, sp_pcontext *ctx)
Definition: sp_instr.h:1141
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1405
Definition: sp_instr.h:1079
sp_instr_hpush_jump(uint ip, sp_pcontext *ctx, sp_handler *handler)
Definition: sp_instr.cc:1331
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1355
uint opt_shortcut_jump(sp_head *, sp_instr *) override
Override sp_instr_jump's shortcut; we stop here.
Definition: sp_instr.h:1104
uint m_opt_hpop
hpop marking end of handler scope.
Definition: sp_instr.h:1123
sp_handler * m_handler
Handler.
Definition: sp_instr.h:1120
void backpatch(uint dest) override
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
Definition: sp_instr.h:1110
~sp_instr_hpush_jump() override
Definition: sp_instr.cc:1340
uint m_frame
Definition: sp_instr.h:1127
static PSI_statement_info psi_info
Definition: sp_instr.h:1133
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1349
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1367
void add_condition(sp_condition_value *condition_value)
Definition: sp_instr.cc:1345
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1131
sp_handler * get_handler()
Definition: sp_instr.h:1087
Definition: sp_instr.h:1167
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1195
uint m_frame
Definition: sp_instr.h:1191
static PSI_statement_info psi_info
Definition: sp_instr.h:1197
uint opt_shortcut_jump(sp_head *, sp_instr *) override
Override sp_instr_jump's shortcut; we stop here.
Definition: sp_instr.h:1184
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1458
sp_instr_hreturn(uint ip, sp_pcontext *ctx)
Definition: sp_instr.cc:1420
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1423
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1444
sp_instr_jump_case_when instruction is used in the "simple CASE" implementation.
Definition: sp_instr.h:1004
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1234
int m_case_expr_id
Identifier (index) of the CASE-expression in the runtime context.
Definition: sp_instr.h:1055
static PSI_statement_info psi_info
Definition: sp_instr.h:1071
Item_case_expr * m_case_expr_item
Item representing the CASE-expression.
Definition: sp_instr.h:1058
bool on_after_expr_parsing(THD *thd) override
Build CASE-expression item tree: Item_func_eq(case-expression, when-i-expression)
Definition: sp_instr.cc:1247
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:1024
Item * m_eq_item
Item corresponding to the main item of the jump-condition-expression: it's the equal function (=) in ...
Definition: sp_instr.h:1065
sp_instr_jump_case_when(uint ip, LEX *lex, int case_expr_id, Item *when_expr_item, LEX_CSTRING when_expr_query)
Definition: sp_instr.h:1006
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1069
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1222
sp_instr_jump_if_not implements SP-instruction, which does the jump if its SQL-expression is false.
Definition: sp_instr.h:880
sp_instr_jump_if_not(uint ip, LEX *lex, Item *expr_item, LEX_CSTRING expr_query)
Definition: sp_instr.h:882
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:904
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1152
static PSI_statement_info psi_info
Definition: sp_instr.h:914
sp_instr_jump_if_not(uint ip, LEX *lex, Item *expr_item, LEX_CSTRING expr_query, uint dest)
Definition: sp_instr.h:887
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:912
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1140
This is base class for all kinds of jump instructions.
Definition: sp_instr.h:724
sp_instr_jump(uint ip, sp_pcontext *ctx)
Definition: sp_instr.h:726
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:776
sp_instr * m_optdest
Definition: sp_instr.h:772
sp_instr_jump(uint ip, sp_pcontext *ctx, uint dest)
Definition: sp_instr.h:729
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1100
uint m_dest
Where we will go.
Definition: sp_instr.h:769
void backpatch(uint dest) override
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
Definition: sp_instr.h:761
static PSI_statement_info psi_info
Definition: sp_instr.h:778
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1093
void opt_move(uint dst, List< sp_branch_instr > *ibp) override
Inform the instruction that it has been moved during optimization.
Definition: sp_instr.cc:1123
uint opt_shortcut_jump(sp_head *sp, sp_instr *start) override
Short-cut jumps to jumps during optimization.
Definition: sp_instr.cc:1108
bool execute(THD *, uint *nextp) override
Execute this instruction.
Definition: sp_instr.h:742
void set_destination(uint old_dest, uint new_dest) override
Update the destination; used by the SP-instruction-optimizer.
Definition: sp_instr.h:757
sp_instr_set_case_expr is used in the "simple CASE" implementation to evaluate and store the CASE-exp...
Definition: sp_instr.h:926
void set_destination(uint old_dest, uint new_dest) override
Update the destination; used by the SP-instruction-optimizer.
Definition: sp_instr.h:965
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1733
void opt_move(uint dst, List< sp_branch_instr > *ibp) override
Inform the instruction that it has been moved during optimization.
Definition: sp_instr.cc:1759
static PSI_statement_info psi_info
Definition: sp_instr.h:991
uint m_case_expr_id
Identifier (index) of the CASE-expression in the runtime context.
Definition: sp_instr.h:985
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:977
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:989
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1710
sp_instr_set_case_expr(uint ip, LEX *lex, uint case_expr_id, Item *case_expr_item, LEX_CSTRING case_expr_query)
Definition: sp_instr.h:928
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1745
void backpatch(uint) override
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
Definition: sp_instr.h:969
sp_instr_set_trigger_field represents SET-statements, which deal with NEW/OLD trigger pseudo-rows.
Definition: sp_instr.h:590
sp_instr_set_trigger_field(uint ip, LEX *lex, LEX_CSTRING trigger_field_name, Item_trigger_field *trigger_field, Item *value_item, LEX_CSTRING value_query)
Definition: sp_instr.h:592
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.cc:1059
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:638
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1033
bool is_invalid() const override
Definition: sp_instr.h:613
static PSI_statement_info psi_info
Definition: sp_instr.h:640
Item_trigger_field * m_trigger_field
Item corresponding to the NEW/OLD trigger field.
Definition: sp_instr.h:628
void cleanup_before_parsing(THD *thd) override
Destroy items in the free list before re-parsing the statement query string (and thus,...
Definition: sp_instr.cc:1079
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1052
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:615
LEX_CSTRING get_expr_query() const override
Definition: sp_instr.h:621
LEX_CSTRING m_trigger_field_name
Trigger field name ("field_name" of the "NEW.field_name").
Definition: sp_instr.h:625
LEX_CSTRING m_value_query
SQL-query corresponding to the value expression.
Definition: sp_instr.h:634
Item * m_value_item
Value expression item of the SET-statement.
Definition: sp_instr.h:631
sp_instr_set represents SET-statements, which deal with SP-variables.
Definition: sp_instr.h:528
LEX_CSTRING get_expr_query() const override
Definition: sp_instr.h:560
LEX_CSTRING m_value_query
SQL-query corresponding to the value expression.
Definition: sp_instr.h:575
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:553
void adjust_sql_command(LEX *lex) override
Some expressions may be re-parsed as SELECT statements, but need to be adjusted to another SQL comman...
Definition: sp_instr.h:562
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:990
sp_instr_set(uint ip, LEX *lex, uint offset, Item *value_item, LEX_CSTRING value_query, bool is_lex_owner)
Definition: sp_instr.h:530
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1006
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:551
Item * m_value_item
Value expression item of the SET-statement.
Definition: sp_instr.h:572
bool is_invalid() const override
Definition: sp_instr.h:549
static PSI_statement_info psi_info
Definition: sp_instr.h:579
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:580
uint m_offset
Frame offset.
Definition: sp_instr.h:569
sp_instr_stmt represents almost all conventional SQL-statements, which are supported outside stored p...
Definition: sp_instr.h:470
bool is_invalid() const override
Definition: sp_instr.h:495
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:497
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:938
sp_instr_stmt(uint ip, LEX *lex, LEX_CSTRING query)
Definition: sp_instr.h:472
static PSI_statement_info psi_info
Definition: sp_instr.h:519
bool on_after_expr_parsing(THD *) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:503
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:962
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:834
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:517
bool m_valid
Specify if the stored LEX-object is up-to-date.
Definition: sp_instr.h:513
LEX_CSTRING m_query
Complete query of the SQL-statement.
Definition: sp_instr.h:510
void get_query(String *sql_query) const override
Return the query string, which can be passed to the parser.
Definition: sp_instr.h:499
Base class for every SP-instruction.
Definition: sp_instr.h:104
bool m_marked
Show if this instruction is reachable within the SP (used by SP-optimizer).
Definition: sp_instr.h:198
virtual SQL_I_List< Item_trigger_field > * get_instr_trig_field_list()
Definition: sp_instr.h:189
sp_instr(uint ip, sp_pcontext *ctx)
Definition: sp_instr.h:106
sp_pcontext * m_parsing_ctx
Instruction parsing context.
Definition: sp_instr.h:204
void clear_da(THD *thd) const
Clear diagnostics area.
Definition: sp_instr.h:147
virtual uint opt_shortcut_jump(sp_head *, sp_instr *start)
Short-cut jumps to jumps during optimization.
Definition: sp_instr.h:173
bool opt_is_marked() const
Definition: sp_instr.h:187
virtual uint get_cont_dest() const
Get the continuation destination (instruction pointer for the CONTINUE HANDLER) of this instruction.
Definition: sp_instr.h:138
virtual uint opt_mark(sp_head *, List< sp_instr > *leads)
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.h:162
void operator=(sp_instr &)
sp_instr(const sp_instr &)
virtual bool execute(THD *thd, uint *nextp)=0
Execute this instruction.
virtual void opt_move(uint dst, List< sp_branch_instr > *ibp)
Inform the instruction that it has been moved during optimization.
Definition: sp_instr.h:183
uint m_ip
Instruction pointer.
Definition: sp_instr.h:201
Query_arena m_arena
Definition: sp_instr.h:193
uint get_ip() const
Definition: sp_instr.h:131
virtual PSI_statement_info * get_psi_info()=0
~sp_instr() override
Definition: sp_instr.h:112
sp_pcontext * get_parsing_ctx() const
Definition: sp_instr.h:140
sp_lex_branch_instr is a base class for SP-instructions, which might perform conditional jump dependi...
Definition: sp_instr.h:788
sp_instr * m_cont_optdest
Definition: sp_instr.h:865
sp_lex_branch_instr(uint ip, sp_pcontext *ctx, LEX *lex, Item *expr_item, LEX_CSTRING expr_query, uint dest)
Definition: sp_instr.h:800
uint m_dest
Where we will go.
Definition: sp_instr.h:858
void opt_move(uint dst, List< sp_branch_instr > *ibp) override
Inform the instruction that it has been moved during optimization.
Definition: sp_instr.cc:1193
sp_lex_branch_instr(uint ip, sp_pcontext *ctx, LEX *lex, Item *expr_item, LEX_CSTRING expr_query)
Definition: sp_instr.h:790
uint m_cont_dest
Where continue handlers will go.
Definition: sp_instr.h:861
bool is_invalid() const override
Definition: sp_instr.h:827
sp_instr * m_optdest
Definition: sp_instr.h:864
void set_destination(uint old_dest, uint new_dest) override
Update the destination; used by the SP-instruction-optimizer.
Definition: sp_instr.h:839
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1169
LEX_CSTRING m_expr_query
SQL-query corresponding to the expression.
Definition: sp_instr.h:871
void adjust_sql_command(LEX *lex) override
Some expressions may be re-parsed as SELECT statements, but need to be adjusted to another SQL comman...
Definition: sp_instr.h:851
LEX_CSTRING get_expr_query() const override
Definition: sp_instr.h:833
Item * m_expr_item
Expression item.
Definition: sp_instr.h:868
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:829
void backpatch(uint dest) override
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
Definition: sp_instr.h:845
uint get_cont_dest() const override
Get the continuation destination (instruction pointer for the CONTINUE HANDLER) of this instruction.
Definition: sp_instr.h:821
void set_cont_dest(uint cont_dest)
Definition: sp_instr.h:811
sp_lex_instr is a class providing the interface and base implementation for SP-instructions,...
Definition: sp_instr.h:223
bool reset_lex_and_exec_core(THD *thd, uint *nextp, bool open_tables)
Prepare LEX and thread for execution of instruction, if requested open and lock LEX's tables,...
Definition: sp_instr.cc:304
~sp_lex_instr() override
Definition: sp_instr.h:235
Table_ref ** m_lex_query_tables_own_last
The value m_lex->query_tables_own_last should be set to this when the statement enters/leaves prelock...
Definition: sp_instr.h:453
void set_lex(LEX *lex, bool is_lex_owner)
Set LEX-object.
Definition: sp_instr.cc:776
virtual LEX_CSTRING get_expr_query() const
Definition: sp_instr.h:389
virtual bool is_invalid() const =0
Table_ref * m_prelocking_tables
List of additional tables this statement needs to lock when it enters/leaves prelocked mode on its ow...
Definition: sp_instr.h:447
LEX * m_lex
LEX-object.
Definition: sp_instr.h:414
virtual void get_query(String *sql_query) const
Return the query string, which can be passed to the parser.
Definition: sp_instr.cc:814
SQL_I_List< Item_trigger_field > * get_instr_trig_field_list() override
Definition: sp_instr.h:266
virtual void adjust_sql_command(LEX *)
Some expressions may be re-parsed as SELECT statements, but need to be adjusted to another SQL comman...
Definition: sp_instr.h:377
SQL_I_List< Item_trigger_field > m_trig_field_list
List of all the Item_trigger_field's of instruction.
Definition: sp_instr.h:458
bool validate_lex_and_execute_core(THD *thd, uint *nextp, bool open_tables)
Make a few attempts to execute the instruction.
Definition: sp_instr.cc:680
LEX * parse_expr(THD *thd, sp_head *sp)
(Re-)parse the query corresponding to this instruction and return a new LEX-object.
Definition: sp_instr.cc:544
void free_lex()
Cleanup and destroy assigned LEX-object if needed.
Definition: sp_instr.cc:786
bool m_is_lex_owner
Indicates whether this sp_lex_instr instance is responsible for LEX-object deletion.
Definition: sp_instr.h:428
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.h:324
virtual bool exec_core(THD *thd, uint *nextp)=0
Execute core function of instruction after all preparations (e.g.
bool m_first_execution
Indicates whether exec_core() has not been already called on the current LEX-object.
Definition: sp_instr.h:434
virtual bool on_after_expr_parsing(THD *thd)
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:401
virtual void invalidate()=0
Invalidate the object.
virtual void cleanup_before_parsing(THD *thd)
Destroy items in the free list before re-parsing the statement query string (and thus,...
Definition: sp_instr.cc:801
sp_lex_instr(uint ip, sp_pcontext *ctx, LEX *lex, bool is_lex_owner)
Definition: sp_instr.h:225
MEM_ROOT m_lex_mem_root
Mem-root for storing the LEX-tree during reparse.
Definition: sp_instr.h:422
The class represents parse-time context, which keeps track of declared variables/parameters,...
Definition: sp_pcontext.h:251
sp_printable defines an interface which should be implemented if a class wants report some internal i...
Definition: sp_instr.h:66
virtual void print(const THD *thd, String *str)=0
virtual ~sp_printable()=default
This class represents a stored program variable or a parameter (also referenced as 'SP-variable').
Definition: sp_pcontext.h:48
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:52
bool open_tables(THD *thd, Table_ref **start, uint *counter, uint flags, Prelocking_strategy *prelocking_strategy)
Open all tables in list.
Definition: sql_base.cc:5757
#define alloc_root_inited(A)
Definition: my_sys.h:808
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:215
Item * single_visible_field() const
Definition: sql_resolver.cc:4834
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:176
constexpr const LEX_CSTRING EMPTY_CSTR
Definition: lex_string.h:47
#define STRING_WITH_LEN(X)
Definition: m_string.h:314
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Header for compiler-dependent features.
Some integer typedefs for easier portability.
#define MYF(v)
Definition: my_inttypes.h:96
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
@ SQLCOM_SELECT
Definition: my_sqlcommand.h:46
@ SQLCOM_END
Definition: my_sqlcommand.h:206
@ SQLCOM_SET_OPTION
Definition: my_sqlcommand.h:77
Common header for many mysys elements.
static int count
Definition: myisam_ftdump.cc:42
static char * query
Definition: myisam_ftdump.cc:44
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1063
Performance schema instrumentation interface.
File containing constants that can be used throughout the server.
constexpr const size_t MEM_ROOT_BLOCK_SIZE
Memory allocated when parsing a statement.
Definition: sql_const.h:127
Our own string classes, used pervasively throughout the executor.
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3693
bool safe_to_cache_query
Whether this query will return the same answer every time, given unchanged data.
Definition: sql_lex.h:3967
Query_block * query_block
First query block.
Definition: sql_lex.h:3698
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: mysql_lex_string.h:39
const char * str
Definition: mysql_lex_string.h:40
size_t length
Definition: mysql_lex_string.h:41
Statement instrument information.
Definition: psi_statement_bits.h:124
unsigned int uint
Definition: uca-dump.cc:29
#define PSI_NOT_INSTRUMENTED
Definition: validate_password_imp.cc:39