Debian Codegraph @

storage/innobase/include/eval0proc.ic

raw
1 /*****************************************************************************
2
3 Copyright (c) 1998, 2026, Oracle and/or its affiliates.
4
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License, version 2.0, as published by the
7 Free Software Foundation.
8
9 This program is designed to work with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have either included with
15 the program or referenced in the documentation.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20 for more details.
21
22 You should have received a copy of the GNU General Public License along with
23 this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26 *****************************************************************************/
27
28 /** @file include/eval0proc.ic
29 Executes SQL stored procedures and their control structures
30
31 Created 1/20/1998 Heikki Tuuri
32 *******************************************************/
33
34 #include "eval0eval.h"
35 #include "pars0pars.h"
36 #include "que0que.h"
37
38 /** Performs an execution step of a procedure node.
39 @return query thread to run next or NULL */
40 static inline que_thr_t *proc_step(que_thr_t *thr) /*!< in: query thread */
41 {
42 proc_node_t *node;
43
44 ut_ad(thr);
45
46 node = static_cast<proc_node_t *>(thr->run_node);
47 ut_ad(que_node_get_type(node) == QUE_NODE_PROC);
48
49 if (thr->prev_node == que_node_get_parent(node)) {
50 /* Start execution from the first statement in the statement
51 list */
52
53 thr->run_node = node->stat_list;
54 } else {
55 /* Move to the next statement */
56 ut_ad(que_node_get_next(thr->prev_node) == nullptr);
57
58 thr->run_node = nullptr;
59 }
60
61 if (thr->run_node == nullptr) {
62 thr->run_node = que_node_get_parent(node);
63 }
64
65 return (thr);
66 }
67
68 /** Performs an execution step of a procedure call node.
69 @return query thread to run next or NULL */
70 static inline que_thr_t *proc_eval_step(que_thr_t *thr) /*!< in: query thread */
71 {
72 func_node_t *node;
73
74 ut_ad(thr);
75
76 node = static_cast<func_node_t *>(thr->run_node);
77 ut_ad(que_node_get_type(node) == QUE_NODE_FUNC);
78
79 /* Evaluate the procedure */
80
81 eval_exp(node);
82
83 thr->run_node = que_node_get_parent(node);
84
85 return (thr);
86 }