~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/eval/eval0proc.c

  • Committer: Lee
  • Date: 2009-01-01 03:07:33 UTC
  • mto: (758.1.3 devel)
  • mto: This revision was merged to the branch mainline in revision 759.
  • Revision ID: lbieber@lbieber-desktop-20090101030733-fb411b55f07vij8q
more header file cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
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., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file eval/eval0proc.c
 
1
/******************************************************
21
2
Executes SQL stored procedures and their control structures
22
3
 
 
4
(c) 1998 Innobase Oy
 
5
 
23
6
Created 1/20/1998 Heikki Tuuri
24
7
*******************************************************/
25
8
 
29
12
#include "eval0proc.ic"
30
13
#endif
31
14
 
32
 
/**********************************************************************//**
33
 
Performs an execution step of an if-statement node.
34
 
@return query thread to run next or NULL */
 
15
/**************************************************************************
 
16
Performs an execution step of an if-statement node. */
35
17
UNIV_INTERN
36
18
que_thr_t*
37
19
if_step(
38
20
/*====*/
39
 
        que_thr_t*      thr)    /*!< in: query thread */
 
21
                                /* out: query thread to run next or NULL */
 
22
        que_thr_t*      thr)    /* in: query thread */
40
23
{
41
24
        if_node_t*      node;
42
25
        elsif_node_t*   elsif_node;
43
26
 
44
27
        ut_ad(thr);
45
28
 
46
 
        node = static_cast<if_node_t *>(thr->run_node);
 
29
        node = thr->run_node;
47
30
        ut_ad(que_node_get_type(node) == QUE_NODE_IF);
48
31
 
49
32
        if (thr->prev_node == que_node_get_parent(node)) {
80
63
                                        break;
81
64
                                }
82
65
 
83
 
                                elsif_node = static_cast<elsif_node_t *>(que_node_get_next(elsif_node));
 
66
                                elsif_node = que_node_get_next(elsif_node);
84
67
 
85
68
                                if (elsif_node == NULL) {
86
69
                                        thr->run_node = NULL;
105
88
        return(thr);
106
89
}
107
90
 
108
 
/**********************************************************************//**
109
 
Performs an execution step of a while-statement node.
110
 
@return query thread to run next or NULL */
 
91
/**************************************************************************
 
92
Performs an execution step of a while-statement node. */
111
93
UNIV_INTERN
112
94
que_thr_t*
113
95
while_step(
114
96
/*=======*/
115
 
        que_thr_t*      thr)    /*!< in: query thread */
 
97
                                /* out: query thread to run next or NULL */
 
98
        que_thr_t*      thr)    /* in: query thread */
116
99
{
117
100
        while_node_t*   node;
118
101
 
119
102
        ut_ad(thr);
120
103
 
121
 
        node = static_cast<while_node_t *>(thr->run_node);
 
104
        node = thr->run_node;
122
105
        ut_ad(que_node_get_type(node) == QUE_NODE_WHILE);
123
106
 
124
107
        ut_ad((thr->prev_node == que_node_get_parent(node))
141
124
        return(thr);
142
125
}
143
126
 
144
 
/**********************************************************************//**
145
 
Performs an execution step of an assignment statement node.
146
 
@return query thread to run next or NULL */
 
127
/**************************************************************************
 
128
Performs an execution step of an assignment statement node. */
147
129
UNIV_INTERN
148
130
que_thr_t*
149
131
assign_step(
150
132
/*========*/
151
 
        que_thr_t*      thr)    /*!< in: query thread */
 
133
                                /* out: query thread to run next or NULL */
 
134
        que_thr_t*      thr)    /* in: query thread */
152
135
{
153
136
        assign_node_t*  node;
154
137
 
155
138
        ut_ad(thr);
156
139
 
157
 
        node = static_cast<assign_node_t *>(thr->run_node);
 
140
        node = thr->run_node;
158
141
        ut_ad(que_node_get_type(node) == QUE_NODE_ASSIGNMENT);
159
142
 
160
143
        /* Evaluate the value to assign */
168
151
        return(thr);
169
152
}
170
153
 
171
 
/**********************************************************************//**
172
 
Performs an execution step of a for-loop node.
173
 
@return query thread to run next or NULL */
 
154
/**************************************************************************
 
155
Performs an execution step of a for-loop node. */
174
156
UNIV_INTERN
175
157
que_thr_t*
176
158
for_step(
177
159
/*=====*/
178
 
        que_thr_t*      thr)    /*!< in: query thread */
 
160
                                /* out: query thread to run next or NULL */
 
161
        que_thr_t*      thr)    /* in: query thread */
179
162
{
180
163
        for_node_t*     node;
181
164
        que_node_t*     parent;
183
166
 
184
167
        ut_ad(thr);
185
168
 
186
 
        node = static_cast<for_node_t *>(thr->run_node);
 
169
        node = thr->run_node;
187
170
 
188
171
        ut_ad(que_node_get_type(node) == QUE_NODE_FOR);
189
172
 
230
213
        return(thr);
231
214
}
232
215
 
233
 
/**********************************************************************//**
234
 
Performs an execution step of an exit statement node.
235
 
@return query thread to run next or NULL */
 
216
/**************************************************************************
 
217
Performs an execution step of an exit statement node. */
236
218
UNIV_INTERN
237
219
que_thr_t*
238
220
exit_step(
239
221
/*======*/
240
 
        que_thr_t*      thr)    /*!< in: query thread */
 
222
                                /* out: query thread to run next or NULL */
 
223
        que_thr_t*      thr)    /* in: query thread */
241
224
{
242
225
        exit_node_t*    node;
243
226
        que_node_t*     loop_node;
244
227
 
245
228
        ut_ad(thr);
246
229
 
247
 
        node = static_cast<exit_node_t *>(thr->run_node);
 
230
        node = thr->run_node;
248
231
 
249
232
        ut_ad(que_node_get_type(node) == QUE_NODE_EXIT);
250
233
 
262
245
        return(thr);
263
246
}
264
247
 
265
 
/**********************************************************************//**
266
 
Performs an execution step of a return-statement node.
267
 
@return query thread to run next or NULL */
 
248
/**************************************************************************
 
249
Performs an execution step of a return-statement node. */
268
250
UNIV_INTERN
269
251
que_thr_t*
270
252
return_step(
271
253
/*========*/
272
 
        que_thr_t*      thr)    /*!< in: query thread */
 
254
                                /* out: query thread to run next or NULL */
 
255
        que_thr_t*      thr)    /* in: query thread */
273
256
{
274
257
        return_node_t*  node;
275
258
        que_node_t*     parent;
276
259
 
277
260
        ut_ad(thr);
278
261
 
279
 
        node = static_cast<return_node_t *>(thr->run_node);
 
262
        node = thr->run_node;
280
263
 
281
264
        ut_ad(que_node_get_type(node) == QUE_NODE_RETURN);
282
265