641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
1 |
/*****************************************************************************
|
2 |
||
3 |
Copyright (c) 1998, 2009, Innobase Oy. All Rights Reserved.
|
|
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 as published by the Free Software
|
|
7 |
Foundation; version 2 of the License.
|
|
8 |
||
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.
|
|
12 |
||
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., 59 Temple
|
|
15 |
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
*****************************************************************************/
|
|
18 |
||
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
19 |
/******************************************************
|
20 |
Executes SQL stored procedures and their control structures
|
|
21 |
||
22 |
Created 1/20/1998 Heikki Tuuri
|
|
23 |
*******************************************************/
|
|
24 |
||
25 |
#include "pars0pars.h" |
|
26 |
#include "que0que.h" |
|
27 |
#include "eval0eval.h" |
|
28 |
||
29 |
/**************************************************************************
|
|
30 |
Performs an execution step of a procedure node. */
|
|
31 |
UNIV_INLINE |
|
32 |
que_thr_t*
|
|
33 |
proc_step(
|
|
34 |
/*======*/
|
|
35 |
/* out: query thread to run next or NULL */ |
|
36 |
que_thr_t* thr) /* in: query thread */ |
|
37 |
{
|
|
38 |
proc_node_t* node; |
|
39 |
||
40 |
ut_ad(thr); |
|
41 |
||
42 |
node = thr->run_node; |
|
43 |
ut_ad(que_node_get_type(node) == QUE_NODE_PROC); |
|
44 |
||
45 |
if (thr->prev_node == que_node_get_parent(node)) { |
|
46 |
/* Start execution from the first statement in the statement |
|
47 |
list */
|
|
48 |
||
49 |
thr->run_node = node->stat_list; |
|
50 |
} else { |
|
51 |
/* Move to the next statement */ |
|
52 |
ut_ad(que_node_get_next(thr->prev_node) == NULL); |
|
53 |
||
54 |
thr->run_node = NULL; |
|
55 |
} |
|
56 |
||
57 |
if (thr->run_node == NULL) { |
|
58 |
thr->run_node = que_node_get_parent(node); |
|
59 |
} |
|
60 |
||
61 |
return(thr); |
|
62 |
}
|
|
63 |
||
64 |
/**************************************************************************
|
|
65 |
Performs an execution step of a procedure call node. */
|
|
66 |
UNIV_INLINE |
|
67 |
que_thr_t*
|
|
68 |
proc_eval_step(
|
|
69 |
/*===========*/
|
|
70 |
/* out: query thread to run next or NULL */ |
|
71 |
que_thr_t* thr) /* in: query thread */ |
|
72 |
{
|
|
73 |
func_node_t* node; |
|
74 |
||
75 |
ut_ad(thr); |
|
76 |
||
77 |
node = thr->run_node; |
|
78 |
ut_ad(que_node_get_type(node) == QUE_NODE_FUNC); |
|
79 |
||
80 |
/* Evaluate the procedure */ |
|
81 |
||
82 |
eval_exp(node); |
|
83 |
||
84 |
thr->run_node = que_node_get_parent(node); |
|
85 |
||
86 |
return(thr); |
|
87 |
}
|