~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2009-01-17 02:46:52 UTC
  • Revision ID: brian@gir-3.local-20090117024652-4ducefje08ajbs1q
Refactor append_identifier and remove dead OPTION_QUOTE_SHOW_CREATE option
(we always quote).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1997, 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
 
 
19
 
/**************************************************//**
20
 
@file pars/pars0sym.c
 
1
/******************************************************
21
2
SQL parser symbol table
22
3
 
 
4
(c) 1997 Innobase Oy
 
5
 
23
6
Created 12/15/1997 Heikki Tuuri
24
7
*******************************************************/
25
8
 
41
24
#include "eval0eval.h"
42
25
#include "row0sel.h"
43
26
 
44
 
/******************************************************************//**
45
 
Creates a symbol table for a single stored procedure or query.
46
 
@return own: symbol table */
 
27
/**********************************************************************
 
28
Creates a symbol table for a single stored procedure or query. */
47
29
UNIV_INTERN
48
30
sym_tab_t*
49
31
sym_tab_create(
50
32
/*===========*/
51
 
        mem_heap_t*     heap)   /*!< in: memory heap where to create */
 
33
                                /* out, own: symbol table */
 
34
        mem_heap_t*     heap)   /* in: memory heap where to create */
52
35
{
53
36
        sym_tab_t*      sym_tab;
54
37
 
62
45
        return(sym_tab);
63
46
}
64
47
 
65
 
/******************************************************************//**
 
48
/**********************************************************************
66
49
Frees the memory allocated dynamically AFTER parsing phase for variables
67
50
etc. in the symbol table. Does not free the mem heap where the table was
68
51
originally created. Frees also SQL explicit cursor definitions. */
70
53
void
71
54
sym_tab_free_private(
72
55
/*=================*/
73
 
        sym_tab_t*      sym_tab)        /*!< in, own: symbol table */
 
56
        sym_tab_t*      sym_tab)        /* in, own: symbol table */
74
57
{
75
58
        sym_node_t*     sym;
76
59
        func_node_t*    func;
100
83
        }
101
84
}
102
85
 
103
 
/******************************************************************//**
104
 
Adds an integer literal to a symbol table.
105
 
@return symbol table node */
 
86
/**********************************************************************
 
87
Adds an integer literal to a symbol table. */
106
88
UNIV_INTERN
107
89
sym_node_t*
108
90
sym_tab_add_int_lit(
109
91
/*================*/
110
 
        sym_tab_t*      sym_tab,        /*!< in: symbol table */
111
 
        ulint           val)            /*!< in: integer value */
 
92
                                        /* out: symbol table node */
 
93
        sym_tab_t*      sym_tab,        /* in: symbol table */
 
94
        ulint           val)            /* in: integer value */
112
95
{
113
96
        sym_node_t*     node;
114
97
        byte*           data;
140
123
        return(node);
141
124
}
142
125
 
143
 
/******************************************************************//**
144
 
Adds a string literal to a symbol table.
145
 
@return symbol table node */
 
126
/**********************************************************************
 
127
Adds a string literal to a symbol table. */
146
128
UNIV_INTERN
147
129
sym_node_t*
148
130
sym_tab_add_str_lit(
149
131
/*================*/
150
 
        sym_tab_t*      sym_tab,        /*!< in: symbol table */
151
 
        byte*           str,            /*!< in: string with no quotes around
 
132
                                        /* out: symbol table node */
 
133
        sym_tab_t*      sym_tab,        /* in: symbol table */
 
134
        byte*           str,            /* in: string with no quotes around
152
135
                                        it */
153
 
        ulint           len)            /*!< in: string length */
 
136
        ulint           len)            /* in: string length */
154
137
{
155
138
        sym_node_t*     node;
156
139
        byte*           data;
187
170
        return(node);
188
171
}
189
172
 
190
 
/******************************************************************//**
191
 
Add a bound literal to a symbol table.
192
 
@return symbol table node */
 
173
/**********************************************************************
 
174
Add a bound literal to a symbol table. */
193
175
UNIV_INTERN
194
176
sym_node_t*
195
177
sym_tab_add_bound_lit(
196
178
/*==================*/
197
 
        sym_tab_t*      sym_tab,        /*!< in: symbol table */
198
 
        const char*     name,           /*!< in: name of bound literal */
199
 
        ulint*          lit_type)       /*!< out: type of literal (PARS_*_LIT) */
 
179
                                        /* out: symbol table node */
 
180
        sym_tab_t*      sym_tab,        /* in: symbol table */
 
181
        const char*     name,           /* in: name of bound literal */
 
182
        ulint*          lit_type)       /* out: type of literal (PARS_*_LIT) */
200
183
{
201
184
        sym_node_t*             node;
202
185
        pars_bound_lit_t*       blit;
263
246
        return(node);
264
247
}
265
248
 
266
 
/******************************************************************//**
267
 
Adds an SQL null literal to a symbol table.
268
 
@return symbol table node */
 
249
/**********************************************************************
 
250
Adds an SQL null literal to a symbol table. */
269
251
UNIV_INTERN
270
252
sym_node_t*
271
253
sym_tab_add_null_lit(
272
254
/*=================*/
273
 
        sym_tab_t*      sym_tab)        /*!< in: symbol table */
 
255
                                        /* out: symbol table node */
 
256
        sym_tab_t*      sym_tab)        /* in: symbol table */
274
257
{
275
258
        sym_node_t*     node;
276
259
 
298
281
        return(node);
299
282
}
300
283
 
301
 
/******************************************************************//**
302
 
Adds an identifier to a symbol table.
303
 
@return symbol table node */
 
284
/**********************************************************************
 
285
Adds an identifier to a symbol table. */
304
286
UNIV_INTERN
305
287
sym_node_t*
306
288
sym_tab_add_id(
307
289
/*===========*/
308
 
        sym_tab_t*      sym_tab,        /*!< in: symbol table */
309
 
        byte*           name,           /*!< in: identifier name */
310
 
        ulint           len)            /*!< in: identifier length */
 
290
                                        /* out: symbol table node */
 
291
        sym_tab_t*      sym_tab,        /* in: symbol table */
 
292
        byte*           name,           /* in: identifier name */
 
293
        ulint           len)            /* in: identifier length */
311
294
{
312
295
        sym_node_t*     node;
313
296
 
334
317
        return(node);
335
318
}
336
319
 
337
 
/******************************************************************//**
338
 
Add a bound identifier to a symbol table.
339
 
@return symbol table node */
 
320
/**********************************************************************
 
321
Add a bound identifier to a symbol table. */
340
322
UNIV_INTERN
341
323
sym_node_t*
342
324
sym_tab_add_bound_id(
343
325
/*===========*/
344
 
        sym_tab_t*      sym_tab,        /*!< in: symbol table */
345
 
        const char*     name)           /*!< in: name of bound id */
 
326
                                        /* out: symbol table node */
 
327
        sym_tab_t*      sym_tab,        /* in: symbol table */
 
328
        const char*     name)           /* in: name of bound id */
346
329
{
347
330
        sym_node_t*             node;
348
331
        pars_bound_id_t*        bid;