~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/pars/pars0sym.c

  • Committer: Monty Taylor
  • Date: 2009-08-12 06:25:19 UTC
  • mto: (1114.1.1 innodb-plugin-merge)
  • mto: This revision was merged to the branch mainline in revision 1183.
  • Revision ID: mordred@inaugust.com-20090812062519-cij02mrrunvnxblt
Tags: innodb-plugin-1.0.4
InnoDB Plugin 1.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
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
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
32
32
#include "mem0mem.h"
33
33
#include "data0type.h"
34
34
#include "data0data.h"
35
 
#ifndef PARS0GRM_H
36
 
# define PARS0GRM_H
37
 
# include "pars0grm.hh"
38
 
#endif
 
35
#include "pars0grm.h"
39
36
#include "pars0pars.h"
40
37
#include "que0que.h"
41
38
#include "eval0eval.h"
52
49
{
53
50
        sym_tab_t*      sym_tab;
54
51
 
55
 
        sym_tab = static_cast<sym_tab_t *>(mem_heap_alloc(heap, sizeof(sym_tab_t)));
 
52
        sym_tab = mem_heap_alloc(heap, sizeof(sym_tab_t));
56
53
 
57
54
        UT_LIST_INIT(sym_tab->sym_list);
58
55
        UT_LIST_INIT(sym_tab->func_node_list);
103
100
/******************************************************************//**
104
101
Adds an integer literal to a symbol table.
105
102
@return symbol table node */
106
 
#ifdef __cplusplus
107
 
extern "C"
108
 
#endif
109
103
UNIV_INTERN
110
104
sym_node_t*
111
105
sym_tab_add_int_lit(
116
110
        sym_node_t*     node;
117
111
        byte*           data;
118
112
 
119
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
113
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
120
114
 
121
115
        node->common.type = QUE_NODE_SYMBOL;
122
116
 
127
121
 
128
122
        dtype_set(dfield_get_type(&node->common.val), DATA_INT, 0, 4);
129
123
 
130
 
        data = static_cast<byte *>(mem_heap_alloc(sym_tab->heap, 4));
 
124
        data = mem_heap_alloc(sym_tab->heap, 4);
131
125
        mach_write_to_4(data, val);
132
126
 
133
127
        dfield_set_data(&(node->common.val), data, 4);
146
140
/******************************************************************//**
147
141
Adds a string literal to a symbol table.
148
142
@return symbol table node */
149
 
#ifdef __cplusplus
150
 
extern "C"
151
 
#endif
152
143
UNIV_INTERN
153
144
sym_node_t*
154
145
sym_tab_add_str_lit(
161
152
        sym_node_t*     node;
162
153
        byte*           data;
163
154
 
164
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
155
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
165
156
 
166
157
        node->common.type = QUE_NODE_SYMBOL;
167
158
 
174
165
                  DATA_VARCHAR, DATA_ENGLISH, 0);
175
166
 
176
167
        if (len) {
177
 
                data = static_cast<byte *>(mem_heap_alloc(sym_tab->heap, len));
 
168
                data = mem_heap_alloc(sym_tab->heap, len);
178
169
                ut_memcpy(data, str, len);
179
170
        } else {
180
171
                data = NULL;
196
187
/******************************************************************//**
197
188
Add a bound literal to a symbol table.
198
189
@return symbol table node */
199
 
#ifdef __cplusplus
200
 
extern "C"
201
 
#endif
202
190
UNIV_INTERN
203
191
sym_node_t*
204
192
sym_tab_add_bound_lit(
214
202
        blit = pars_info_get_bound_lit(sym_tab->info, name);
215
203
        ut_a(blit);
216
204
 
217
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
205
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
218
206
 
219
207
        node->common.type = QUE_NODE_SYMBOL;
220
208
 
275
263
/******************************************************************//**
276
264
Adds an SQL null literal to a symbol table.
277
265
@return symbol table node */
278
 
#ifdef __cplusplus
279
 
extern "C"
280
 
#endif
281
266
UNIV_INTERN
282
267
sym_node_t*
283
268
sym_tab_add_null_lit(
286
271
{
287
272
        sym_node_t*     node;
288
273
 
289
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
274
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
290
275
 
291
276
        node->common.type = QUE_NODE_SYMBOL;
292
277
 
313
298
/******************************************************************//**
314
299
Adds an identifier to a symbol table.
315
300
@return symbol table node */
316
 
#ifdef __cplusplus
317
 
extern "C"
318
 
#endif
319
301
UNIV_INTERN
320
302
sym_node_t*
321
303
sym_tab_add_id(
326
308
{
327
309
        sym_node_t*     node;
328
310
 
329
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
311
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
330
312
 
331
313
        node->common.type = QUE_NODE_SYMBOL;
332
314
 
352
334
/******************************************************************//**
353
335
Add a bound identifier to a symbol table.
354
336
@return symbol table node */
355
 
#ifdef __cplusplus
356
 
extern "C"
357
 
#endif
358
337
UNIV_INTERN
359
338
sym_node_t*
360
339
sym_tab_add_bound_id(
368
347
        bid = pars_info_get_bound_id(sym_tab->info, name);
369
348
        ut_a(bid);
370
349
 
371
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
350
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
372
351
 
373
352
        node->common.type = QUE_NODE_SYMBOL;
374
353