InnoDB Plugin  1.0
pars0sym.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1997, 2009, Oracle and/or its affiliates. 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.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #ifndef pars0sym_h
27 #define pars0sym_h
28 
29 #include "univ.i"
30 #include "que0types.h"
31 #include "usr0types.h"
32 #include "dict0types.h"
33 #include "pars0types.h"
34 #include "row0types.h"
35 
36 /******************************************************************/
39 UNIV_INTERN
40 sym_tab_t*
42 /*===========*/
43  mem_heap_t* heap);
44 /******************************************************************/
48 UNIV_INTERN
49 void
51 /*=================*/
52  sym_tab_t* sym_tab);
53 /******************************************************************/
56 UNIV_INTERN
59 /*================*/
60  sym_tab_t* sym_tab,
61  ulint val);
62 /******************************************************************/
65 UNIV_INTERN
68 /*================*/
69  sym_tab_t* sym_tab,
70  const byte* str,
72  ulint len);
73 /******************************************************************/
76 UNIV_INTERN
79 /*==================*/
80  sym_tab_t* sym_tab,
81  const char* name,
82  ulint* lit_type);
83 /**********************************************************************
84 Rebind literal to a node in the symbol table. */
85 
87 sym_tab_rebind_lit(
88 /*===============*/
89  /* out: symbol table node */
90  sym_node_t* node, /* in: node that is bound to literal*/
91  const void* address, /* in: pointer to data */
92  ulint length); /* in: length of data */
93 /******************************************************************/
96 UNIV_INTERN
99 /*=================*/
100  sym_tab_t* sym_tab);
101 /******************************************************************/
104 UNIV_INTERN
105 sym_node_t*
107 /*===========*/
108  sym_tab_t* sym_tab,
109  byte* name,
110  ulint len);
112 /******************************************************************/
115 UNIV_INTERN
116 sym_node_t*
118 /*===========*/
119  sym_tab_t* sym_tab,
120  const char* name);
123 #define SYM_CLUST_FIELD_NO 0
124 
125 #define SYM_SEC_FIELD_NO 1
126 
130  SYM_VAR = 91,
143 };
144 
146 struct sym_node_t{
149  /* NOTE: if the data field in 'common.val' is not NULL and the symbol
150  table node is not for a temporary column, the memory for the value has
151  been allocated from dynamic memory and it should be freed when the
152  symbol table is discarded */
153 
154  /* 'alias' and 'indirection' are almost the same, but not quite.
155  'alias' always points to the primary instance of the variable, while
156  'indirection' does the same only if we should use the primary
157  instance's values for the node's data. This is usually the case, but
158  when initializing a cursor (e.g., "DECLARE CURSOR c IS SELECT * FROM
159  t WHERE id = x;"), we copy the values from the primary instance to
160  the cursor's instance so that they are fixed for the duration of the
161  cursor, and set 'indirection' to NULL. If we did not, the value of
162  'x' could change between fetches and things would break horribly.
163 
164  TODO: It would be cleaner to make 'indirection' a boolean field and
165  always use 'alias' to refer to the primary node. */
166 
177  UT_LIST_NODE_T(sym_node_t) col_var_list;
185  ulint field_nos[2];
204  const char* name;
205  ulint name_len;
209  ulint col_no;
218  ulint param_type;
224  UT_LIST_NODE_T(sym_node_t) sym_list;
226  sym_node_t* like_node; /* LIKE operator node*/
227 };
228 
230 struct sym_tab_t{
231  que_t* query_graph;
234  const char* sql_string;
236  size_t string_len;
238  int next_char_pos;
243  sym_node_list_t sym_list;
246  UT_LIST_BASE_NODE_T(func_node_t)
247  func_node_list;
250  mem_heap_t* heap;
252 };
253 
254 #ifndef UNIV_NONINL
255 #include "pars0sym.ic"
256 #endif
257 
258 #endif