mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / innodb_plugin / include / eval0proc.ic
blob6949af1557b61f17b81356e0521e8b1c24d04c96
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"
27 #include "que0que.h"
28 #include "eval0eval.h"
30 /**********************************************************************//**
31 Performs an execution step of a procedure node.
32 @return query thread to run next or NULL */
33 UNIV_INLINE
34 que_thr_t*
35 proc_step(
36 /*======*/
37         que_thr_t*      thr)    /*!< in: query thread */
39         proc_node_t*    node;
41         ut_ad(thr);
43         node = thr->run_node;
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
48                 list */
50                 thr->run_node = node->stat_list;
51         } else {
52                 /* Move to the next statement */
53                 ut_ad(que_node_get_next(thr->prev_node) == NULL);
55                 thr->run_node = NULL;
56         }
58         if (thr->run_node == NULL) {
59                 thr->run_node = que_node_get_parent(node);
60         }
62         return(thr);
65 /**********************************************************************//**
66 Performs an execution step of a procedure call node.
67 @return query thread to run next or NULL */
68 UNIV_INLINE
69 que_thr_t*
70 proc_eval_step(
71 /*===========*/
72         que_thr_t*      thr)    /*!< in: query thread */
74         func_node_t*    node;
76         ut_ad(thr);
78         node = thr->run_node;
79         ut_ad(que_node_get_type(node) == QUE_NODE_FUNC);
81         /* Evaluate the procedure */
83         eval_exp(node);
85         thr->run_node = que_node_get_parent(node);
87         return(thr);