drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
pars0sym.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
25
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/******************************************************************/
40UNIV_INTERN
41sym_tab_t*
43/*===========*/
44 mem_heap_t* heap);
45/******************************************************************/
49UNIV_INTERN
50void
52/*=================*/
53 sym_tab_t* sym_tab);
54/******************************************************************/
57#ifdef __cplusplus
58extern "C"
59#endif
60UNIV_INTERN
61sym_node_t*
63/*================*/
64 sym_tab_t* sym_tab,
65 ulint val);
66/******************************************************************/
69#ifdef __cplusplus
70extern "C"
71#endif
72UNIV_INTERN
73sym_node_t*
75/*================*/
76 sym_tab_t* sym_tab,
77 byte* str,
79 ulint len);
80/******************************************************************/
83#ifdef __cplusplus
84extern "C"
85#endif
86UNIV_INTERN
87sym_node_t*
89/*==================*/
90 sym_tab_t* sym_tab,
91 const char* name,
92 ulint* lit_type);
93/******************************************************************/
96#ifdef __cplusplus
97extern "C"
98#endif
99UNIV_INTERN
100sym_node_t*
102/*=================*/
103 sym_tab_t* sym_tab);
104/******************************************************************/
107#ifdef __cplusplus
108extern "C"
109#endif
110UNIV_INTERN
111sym_node_t*
113/*===========*/
114 sym_tab_t* sym_tab,
115 byte* name,
116 ulint len);
117
118/******************************************************************/
121#ifdef __cplusplus
122extern "C"
123#endif
124UNIV_INTERN
125sym_node_t*
127/*===========*/
128 sym_tab_t* sym_tab,
129 const char* name);
130
132#define SYM_CLUST_FIELD_NO 0
134#define SYM_SEC_FIELD_NO 1
135
150
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;
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;
228 sym_tab_t* sym_table;
230 UT_LIST_NODE_T(sym_node_t) sym_list;
232};
233
239 const char* sql_string;
247 pars_info_t* info;
248 sym_node_list_t sym_list;
251 UT_LIST_BASE_NODE_T(func_node_t)
255 mem_heap_t* heap;
257};
258
259#ifndef UNIV_NONINL
260#include "pars0sym.ic"
261#endif
262
263#endif
UNIV_INTERN sym_node_t * sym_tab_add_bound_id(sym_tab_t *sym_tab, const char *name)
Definition pars0sym.cc:360
UNIV_INTERN sym_node_t * sym_tab_add_null_lit(sym_tab_t *sym_tab)
Definition pars0sym.cc:283
UNIV_INTERN void sym_tab_free_private(sym_tab_t *sym_tab)
Definition pars0sym.cc:71
sym_tab_entry
Definition pars0sym.h:137
@ SYM_COLUMN
Definition pars0sym.h:144
@ SYM_PROCEDURE_NAME
Definition pars0sym.h:146
@ SYM_VAR
Definition pars0sym.h:138
@ SYM_CURSOR
Definition pars0sym.h:145
@ SYM_TABLE
Definition pars0sym.h:143
@ SYM_IMPLICIT_VAR
Definition pars0sym.h:140
@ SYM_FUNCTION
Definition pars0sym.h:148
@ SYM_LIT
Definition pars0sym.h:142
@ SYM_INDEX
Definition pars0sym.h:147
UNIV_INTERN sym_tab_t * sym_tab_create(mem_heap_t *heap)
Definition pars0sym.cc:49
UNIV_INTERN sym_node_t * sym_tab_add_int_lit(sym_tab_t *sym_tab, ulint val)
Definition pars0sym.cc:111
UNIV_INTERN sym_node_t * sym_tab_add_id(sym_tab_t *sym_tab, byte *name, ulint len)
Definition pars0sym.cc:321
UNIV_INTERN sym_node_t * sym_tab_add_bound_lit(sym_tab_t *sym_tab, const char *name, ulint *lit_type)
Definition pars0sym.cc:204
UNIV_INTERN sym_node_t * sym_tab_add_str_lit(sym_tab_t *sym_tab, byte *str, ulint len)
Definition pars0sym.cc:154
sym_node_t * alias
Definition pars0sym.h:178
sel_buf_t * prefetch_buf
Definition pars0sym.h:217
sym_tab_t * sym_table
Definition pars0sym.h:228
enum sym_tab_entry token_type
Definition pars0sym.h:208
UT_LIST_NODE_T(sym_node_t) sym_list
ulint field_nos[2]
Definition pars0sym.h:191
dict_table_t * table
Definition pars0sym.h:212
que_common_t common
Definition pars0sym.h:153
UT_LIST_NODE_T(sym_node_t) col_var_list
sym_node_t * indirection
Definition pars0sym.h:173
const char * name
Definition pars0sym.h:210
sel_node_t * cursor_def
Definition pars0sym.h:221
mem_heap_t * heap
Definition pars0sym.h:255
sym_node_list_t sym_list
Definition pars0sym.h:248
que_t * query_graph
Definition pars0sym.h:236
pars_info_t * info
Definition pars0sym.h:247
const char * sql_string
Definition pars0sym.h:239
size_t string_len
Definition pars0sym.h:241
#define UT_LIST_BASE_NODE_T(TYPE)
Definition ut0lst.h:54