Drizzled Public API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
pars0sym.h
Go to the documentation of this file.
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., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
17
*****************************************************************************/
18
19
/**************************************************/
26
#pragma once
27
#ifndef pars0sym_h
28
#define pars0sym_h
29
30
#include "univ.i"
31
#include "
que0types.h
"
32
#include "
usr0types.h
"
33
#include "
dict0types.h
"
34
#include "
pars0types.h
"
35
#include "
row0types.h
"
36
37
/******************************************************************/
40
UNIV_INTERN
41
sym_tab_t
*
42
sym_tab_create
(
43
/*===========*/
44
mem_heap_t
* heap);
45
/******************************************************************/
49
UNIV_INTERN
50
void
51
sym_tab_free_private
(
52
/*=================*/
53
sym_tab_t
* sym_tab);
54
/******************************************************************/
57
#ifdef __cplusplus
58
extern
"C"
59
#endif
60
UNIV_INTERN
61
sym_node_t
*
62
sym_tab_add_int_lit
(
63
/*================*/
64
sym_tab_t
* sym_tab,
65
ulint val);
66
/******************************************************************/
69
#ifdef __cplusplus
70
extern
"C"
71
#endif
72
UNIV_INTERN
73
sym_node_t
*
74
sym_tab_add_str_lit
(
75
/*================*/
76
sym_tab_t
* sym_tab,
77
byte* str,
79
ulint len);
80
/******************************************************************/
83
#ifdef __cplusplus
84
extern
"C"
85
#endif
86
UNIV_INTERN
87
sym_node_t
*
88
sym_tab_add_bound_lit
(
89
/*==================*/
90
sym_tab_t
* sym_tab,
91
const
char
* name,
92
ulint* lit_type);
93
/******************************************************************/
96
#ifdef __cplusplus
97
extern
"C"
98
#endif
99
UNIV_INTERN
100
sym_node_t
*
101
sym_tab_add_null_lit
(
102
/*=================*/
103
sym_tab_t
* sym_tab);
104
/******************************************************************/
107
#ifdef __cplusplus
108
extern
"C"
109
#endif
110
UNIV_INTERN
111
sym_node_t
*
112
sym_tab_add_id
(
113
/*===========*/
114
sym_tab_t
* sym_tab,
115
byte* name,
116
ulint len);
118
/******************************************************************/
121
#ifdef __cplusplus
122
extern
"C"
123
#endif
124
UNIV_INTERN
125
sym_node_t
*
126
sym_tab_add_bound_id
(
127
/*===========*/
128
sym_tab_t
* sym_tab,
129
const
char
* name);
132
#define SYM_CLUST_FIELD_NO 0
133
134
#define SYM_SEC_FIELD_NO 1
135
137
enum
sym_tab_entry
{
138
SYM_VAR
= 91,
140
SYM_IMPLICIT_VAR
,
142
SYM_LIT
,
143
SYM_TABLE
,
144
SYM_COLUMN
,
145
SYM_CURSOR
,
146
SYM_PROCEDURE_NAME
,
147
SYM_INDEX
,
148
SYM_FUNCTION
149
};
150
152
struct
sym_node_struct
{
153
que_common_t
common
;
155
/* NOTE: if the data field in 'common.val' is not NULL and the symbol
156
table node is not for a temporary column, the memory for the value has
157
been allocated from dynamic memory and it should be freed when the
158
symbol table is discarded */
159
160
/* 'alias' and 'indirection' are almost the same, but not quite.
161
'alias' always points to the primary instance of the variable, while
162
'indirection' does the same only if we should use the primary
163
instance's values for the node's data. This is usually the case, but
164
when initializing a cursor (e.g., "DECLARE CURSOR c IS SELECT * FROM
165
t WHERE id = x;"), we copy the values from the primary instance to
166
the cursor's instance so that they are fixed for the duration of the
167
cursor, and set 'indirection' to NULL. If we did not, the value of
168
'x' could change between fetches and things would break horribly.
169
170
TODO: It would be cleaner to make 'indirection' a boolean field and
171
always use 'alias' to refer to the primary node. */
172
173
sym_node_t
*
indirection
;
178
sym_node_t
*
alias
;
183
UT_LIST_NODE_T
(
sym_node_t
) col_var_list;
187
ibool
copy_val
;
191
ulint
field_nos
[2];
203
ibool
resolved
;
208
enum
sym_tab_entry
token_type
;
210
const
char
*
name
;
211
ulint
name_len
;
212
dict_table_t
*
table
;
215
ulint
col_no
;
217
sel_buf_t
*
prefetch_buf
;
221
sel_node_t
*
cursor_def
;
224
ulint
param_type
;
228
sym_tab_t
*
sym_table
;
230
UT_LIST_NODE_T
(
sym_node_t
) sym_list;
232
};
233
235
struct
sym_tab_struct
{
236
que_t
* query_graph;
239
const
char
* sql_string;
241
size_t
string_len;
243
int
next_char_pos;
247
pars_info_t
*
info
;
248
sym_node_list_t sym_list;
251
UT_LIST_BASE_NODE_T
(
func_node_t
)
252
func_node_list;
255
mem_heap_t
* heap;
257
};
258
259
#ifndef UNIV_NONINL
260
#include "pars0sym.ic"
261
#endif
262
263
#endif
plugin
innobase
include
pars0sym.h
Generated on Sun Jun 3 2012 18:09:25 for drizzle by
1.8.1