1 /*****************************************************************************
3 Copyright (c) 1998, 2009, Innobase Oy. All Rights Reserved.
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *****************************************************************************/
19 /**************************************************//**
20 @file include/eval0proc.ic
21 Executes SQL stored procedures and their control structures
23 Created 1/20/1998 Heikki Tuuri
24 *******************************************************/
26 #include "pars0pars.h"
28 #include "eval0eval.h"
30 /**********************************************************************//**
31 Performs an execution step of a procedure node.
32 @return query thread to run next or NULL */
37 que_thr_t* thr) /*!< in: query thread */
44 ut_ad(que_node_get_type(node) == QUE_NODE_PROC);
46 if (thr->prev_node == que_node_get_parent(node)) {
47 /* Start execution from the first statement in the statement
50 thr->run_node = node->stat_list;
52 /* Move to the next statement */
53 ut_ad(que_node_get_next(thr->prev_node) == NULL);
58 if (thr->run_node == NULL) {
59 thr->run_node = que_node_get_parent(node);
65 /**********************************************************************//**
66 Performs an execution step of a procedure call node.
67 @return query thread to run next or NULL */
72 que_thr_t* thr) /*!< in: query thread */
79 ut_ad(que_node_get_type(node) == QUE_NODE_FUNC);
81 /* Evaluate the procedure */
85 thr->run_node = que_node_get_parent(node);