390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
1
by brian
clean slate |
19 |
|
1014.4.1
by Jay Pipes
Cosmetic: make sql_lex.h include guard match rest of drizzled/ headers. |
20 |
#ifndef DRIZZLED_SQL_LEX_H
|
21 |
#define DRIZZLED_SQL_LEX_H
|
|
243.1.8
by Jay Pipes
More cleanup and revert broken base.h |
22 |
|
1
by brian
clean slate |
23 |
/**
|
24 |
@defgroup Semantic_Analysis Semantic Analysis
|
|
25 |
*/
|
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
26 |
#include <drizzled/message/table.pb.h> |
27 |
||
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
28 |
#include "drizzled/plugin/function.h" |
934.2.1
by Jay Pipes
Split index hints out into their own file, removal from sql_lex.h and sql_select.cc |
29 |
#include "drizzled/name_resolution_context.h" |
30 |
#include "drizzled/item/subselect.h" |
|
31 |
#include "drizzled/table_list.h" |
|
32 |
#include "drizzled/function/math/real.h" |
|
33 |
#include "drizzled/alter_drop.h" |
|
34 |
#include "drizzled/alter_column.h" |
|
1126.3.3
by Jay Pipes
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo. |
35 |
#include "drizzled/alter_info.h" |
1237.9.4
by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file. |
36 |
#include "drizzled/key_part_spec.h" |
934.2.1
by Jay Pipes
Split index hints out into their own file, removal from sql_lex.h and sql_select.cc |
37 |
#include "drizzled/index_hint.h" |
1100.3.30
by Padraig O'Sullivan
Renamed the Command class to be Statement. Renamed the command directory to |
38 |
#include "drizzled/statement.h" |
1237.13.30
by Padraig O'Sullivan
Corrected a valgrind warning due to using std::string in the Select_Lex class whose memory is |
39 |
#include "drizzled/optimizer/explain_plan.h" |
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
40 |
|
1089.6.3
by Padraig O'Sullivan
Replaced an instance where a uint8_t type was being used to hold a |
41 |
#include <bitset> |
1240.7.3
by Padraig O'Sullivan
Used std::string for the type in Select_Lex instead of char *. |
42 |
#include <string> |
1089.6.3
by Padraig O'Sullivan
Replaced an instance where a uint8_t type was being used to hold a |
43 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
44 |
namespace drizzled |
45 |
{
|
|
46 |
||
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
47 |
class select_result_interceptor; |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
48 |
|
1
by brian
clean slate |
49 |
/* YACC and LEX Definitions */
|
50 |
||
51 |
/* These may not be declared yet */
|
|
52 |
class Table_ident; |
|
831.1.2
by Brian Aker
Rename class file_exchange |
53 |
class file_exchange; |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
54 |
class Lex_Column; |
675
by Brian Aker
Cleanup around item includes. |
55 |
class Item_outer_ref; |
1
by brian
clean slate |
56 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
57 |
} /* namespace drizzled */ |
58 |
||
1
by brian
clean slate |
59 |
/*
|
60 |
The following hack is needed because mysql_yacc.cc does not define
|
|
61 |
YYSTYPE before including this file
|
|
62 |
*/
|
|
63 |
||
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
64 |
#ifdef DRIZZLE_SERVER
|
65 |
# include <drizzled/set_var.h>
|
|
66 |
# include <drizzled/item/func.h>
|
|
67 |
# ifdef DRIZZLE_YACC
|
|
68 |
# define LEX_YYSTYPE void *
|
|
69 |
# else
|
|
70 |
# if defined(DRIZZLE_LEX)
|
|
1237.9.4
by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file. |
71 |
# include <drizzled/foreign_key.h>
|
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
72 |
# include <drizzled/lex_symbol.h>
|
73 |
# include <drizzled/sql_yacc.h>
|
|
74 |
# define LEX_YYSTYPE YYSTYPE *
|
|
75 |
# else
|
|
76 |
# define LEX_YYSTYPE void *
|
|
77 |
# endif /* defined(DRIZZLE_LEX) */ |
|
78 |
# endif /* DRIZZLE_YACC */ |
|
79 |
#endif /* DRIZZLE_SERVER */ |
|
1
by brian
clean slate |
80 |
|
81 |
// describe/explain types
|
|
82 |
#define DESCRIBE_NORMAL 1
|
|
83 |
#define DESCRIBE_EXTENDED 2
|
|
84 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
85 |
#ifdef DRIZZLE_SERVER
|
1
by brian
clean slate |
86 |
|
87 |
#define DERIVED_NONE 0
|
|
88 |
#define DERIVED_SUBQUERY 1
|
|
89 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
90 |
namespace drizzled |
91 |
{
|
|
92 |
||
1
by brian
clean slate |
93 |
typedef List<Item> List_item; |
94 |
||
95 |
enum sub_select_type |
|
96 |
{
|
|
1027
by Brian Aker
Merge Jay |
97 |
UNSPECIFIED_TYPE, |
98 |
UNION_TYPE, |
|
99 |
INTERSECT_TYPE, |
|
100 |
EXCEPT_TYPE, |
|
101 |
GLOBAL_OPTIONS_TYPE, |
|
102 |
DERIVED_TABLE_TYPE, |
|
103 |
OLAP_TYPE
|
|
1
by brian
clean slate |
104 |
};
|
105 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
106 |
enum olap_type |
1
by brian
clean slate |
107 |
{
|
1027
by Brian Aker
Merge Jay |
108 |
UNSPECIFIED_OLAP_TYPE, |
109 |
CUBE_TYPE, |
|
110 |
ROLLUP_TYPE
|
|
1
by brian
clean slate |
111 |
};
|
112 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
113 |
/*
|
114 |
The state of the lex parsing for selects
|
|
115 |
||
1
by brian
clean slate |
116 |
master and slaves are pointers to select_lex.
|
117 |
master is pointer to upper level node.
|
|
118 |
slave is pointer to lower level node
|
|
119 |
select_lex is a SELECT without union
|
|
120 |
unit is container of either
|
|
121 |
- One SELECT
|
|
122 |
- UNION of selects
|
|
123 |
select_lex and unit are both inherited form select_lex_node
|
|
124 |
neighbors are two select_lex or units on the same level
|
|
125 |
||
126 |
All select describing structures linked with following pointers:
|
|
127 |
- list of neighbors (next/prev) (prev of first element point to slave
|
|
128 |
pointer of upper structure)
|
|
129 |
- For select this is a list of UNION's (or one element list)
|
|
130 |
- For units this is a list of sub queries for the upper level select
|
|
131 |
||
132 |
- pointer to master (master), which is
|
|
133 |
If this is a unit
|
|
134 |
- pointer to outer select_lex
|
|
135 |
If this is a select_lex
|
|
136 |
- pointer to outer unit structure for select
|
|
137 |
||
138 |
- pointer to slave (slave), which is either:
|
|
139 |
If this is a unit:
|
|
140 |
- first SELECT that belong to this unit
|
|
141 |
If this is a select_lex
|
|
142 |
- first unit that belong to this SELECT (subquries or derived tables)
|
|
143 |
||
144 |
- list of all select_lex (link_next/link_prev)
|
|
145 |
This is to be used for things like derived tables creation, where we
|
|
146 |
go through this list and create the derived tables.
|
|
147 |
||
148 |
If unit contain several selects (UNION now, INTERSECT etc later)
|
|
149 |
then it have special select_lex called fake_select_lex. It used for
|
|
150 |
storing global parameters (like ORDER BY, LIMIT) and executing union.
|
|
151 |
Subqueries used in global ORDER BY clause will be attached to this
|
|
152 |
fake_select_lex, which will allow them correctly resolve fields of
|
|
153 |
'upper' UNION and outer selects.
|
|
154 |
||
155 |
For example for following query:
|
|
156 |
||
157 |
select *
|
|
158 |
from table1
|
|
159 |
where table1.field IN (select * from table1_1_1 union
|
|
160 |
select * from table1_1_2)
|
|
161 |
union
|
|
162 |
select *
|
|
163 |
from table2
|
|
164 |
where table2.field=(select (select f1 from table2_1_1_1_1
|
|
165 |
where table2_1_1_1_1.f2=table2_1_1.f3)
|
|
166 |
from table2_1_1
|
|
167 |
where table2_1_1.f1=table2.f2)
|
|
168 |
union
|
|
169 |
select * from table3;
|
|
170 |
||
171 |
we will have following structure:
|
|
172 |
||
173 |
select1: (select * from table1 ...)
|
|
174 |
select2: (select * from table2 ...)
|
|
175 |
select3: (select * from table3)
|
|
176 |
select1.1.1: (select * from table1_1_1)
|
|
177 |
...
|
|
178 |
||
179 |
main unit
|
|
180 |
fake0
|
|
181 |
select1 select2 select3
|
|
182 |
|^^ |^
|
|
183 |
s||| ||master
|
|
184 |
l||| |+---------------------------------+
|
|
185 |
a||| +---------------------------------+|
|
|
186 |
v|||master slave ||
|
|
187 |
e||+-------------------------+ ||
|
|
188 |
V| neighbor | V|
|
|
189 |
unit1.1<+==================>unit1.2 unit2.1
|
|
190 |
fake1.1
|
|
191 |
select1.1.1 select 1.1.2 select1.2.1 select2.1.1
|
|
192 |
|^
|
|
193 |
||
|
|
194 |
V|
|
|
195 |
unit2.1.1.1
|
|
196 |
select2.1.1.1.1
|
|
197 |
||
198 |
||
199 |
relation in main unit will be following:
|
|
200 |
(bigger picture for:
|
|
201 |
main unit
|
|
202 |
fake0
|
|
203 |
select1 select2 select3
|
|
204 |
in the above picture)
|
|
205 |
||
206 |
main unit
|
|
207 |
|^^^^|fake_select_lex
|
|
208 |
|||||+--------------------------------------------+
|
|
209 |
||||+--------------------------------------------+|
|
|
210 |
|||+------------------------------+ ||
|
|
211 |
||+--------------+ | ||
|
|
212 |
slave||master | | ||
|
|
213 |
V| neighbor | neighbor | master|V
|
|
214 |
select1<========>select2<========>select3 fake0
|
|
215 |
||
216 |
list of all select_lex will be following (as it will be constructed by
|
|
217 |
parser):
|
|
218 |
||
219 |
select1->select2->select3->select2.1.1->select 2.1.2->select2.1.1.1.1-+
|
|
220 |
|
|
|
221 |
+---------------------------------------------------------------------+
|
|
222 |
|
|
|
223 |
+->select1.1.1->select1.1.2
|
|
224 |
||
225 |
*/
|
|
226 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
227 |
/*
|
846
by Brian Aker
Removing on typedeffed class. |
228 |
Base class for Select_Lex (Select_Lex) &
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
229 |
Select_Lex_Unit (Select_Lex_Unit)
|
1
by brian
clean slate |
230 |
*/
|
575.4.7
by Monty Taylor
More header cleanup. |
231 |
class LEX; |
846
by Brian Aker
Removing on typedeffed class. |
232 |
class Select_Lex; |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
233 |
class Select_Lex_Unit; |
847
by Brian Aker
More typdef class removal. |
234 |
class Select_Lex_Node { |
1
by brian
clean slate |
235 |
protected: |
847
by Brian Aker
More typdef class removal. |
236 |
Select_Lex_Node *next, **prev, /* neighbor list */ |
1
by brian
clean slate |
237 |
*master, *slave, /* vertical links */ |
846
by Brian Aker
Removing on typedeffed class. |
238 |
*link_next, **link_prev; /* list of whole Select_Lex */ |
1
by brian
clean slate |
239 |
public: |
240 |
||
151
by Brian Aker
Ulonglong to uint64_t |
241 |
uint64_t options; |
1
by brian
clean slate |
242 |
|
243 |
/*
|
|
244 |
result of this query can't be cached, bit field, can be :
|
|
245 |
UNCACHEABLE_DEPENDENT
|
|
246 |
UNCACHEABLE_RAND
|
|
247 |
UNCACHEABLE_SIDEEFFECT
|
|
248 |
UNCACHEABLE_EXPLAIN
|
|
249 |
UNCACHEABLE_PREPARE
|
|
250 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
251 |
uint8_t uncacheable; |
1
by brian
clean slate |
252 |
enum sub_select_type linkage; |
253 |
bool no_table_names_allowed; /* used for global order by */ |
|
254 |
bool no_error; /* suppress error message (convert it to warnings) */ |
|
255 |
||
256 |
static void *operator new(size_t size) |
|
257 |
{
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
258 |
return memory::sql_alloc(size); |
1
by brian
clean slate |
259 |
}
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
260 |
static void *operator new(size_t size, memory::Root *mem_root) |
202
by Brian Aker
Cleanup sql_lex to modern types. |
261 |
{ return (void*) alloc_root(mem_root, (uint32_t) size); } |
644
by Brian Aker
Clean up warnings for Solaris. |
262 |
static void operator delete(void *, size_t) |
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
263 |
{ } |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
264 |
static void operator delete(void *, memory::Root *) |
77.1.7
by Monty Taylor
Heap builds clean. |
265 |
{}
|
847
by Brian Aker
More typdef class removal. |
266 |
Select_Lex_Node(): linkage(UNSPECIFIED_TYPE) {} |
267 |
virtual ~Select_Lex_Node() {} |
|
268 |
inline Select_Lex_Node* get_master() { return master; } |
|
1
by brian
clean slate |
269 |
virtual void init_query(); |
270 |
virtual void init_select(); |
|
847
by Brian Aker
More typdef class removal. |
271 |
void include_down(Select_Lex_Node *upper); |
272 |
void include_neighbour(Select_Lex_Node *before); |
|
273 |
void include_standalone(Select_Lex_Node *sel, Select_Lex_Node **ref); |
|
274 |
void include_global(Select_Lex_Node **plink); |
|
1
by brian
clean slate |
275 |
void exclude(); |
276 |
||
848
by Brian Aker
typdef class removal (just... use the name of the class). |
277 |
virtual Select_Lex_Unit* master_unit()= 0; |
846
by Brian Aker
Removing on typedeffed class. |
278 |
virtual Select_Lex* outer_select()= 0; |
279 |
virtual Select_Lex* return_after_parsing()= 0; |
|
1
by brian
clean slate |
280 |
|
281 |
virtual bool set_braces(bool value); |
|
282 |
virtual bool inc_in_sum_expr(); |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
283 |
virtual uint32_t get_in_sum_expr(); |
327.2.4
by Brian Aker
Refactoring table.h |
284 |
virtual TableList* get_table_list(); |
1
by brian
clean slate |
285 |
virtual List<Item>* get_item_list(); |
202
by Brian Aker
Cleanup sql_lex to modern types. |
286 |
virtual uint32_t get_table_join_options(); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
287 |
virtual TableList *add_table_to_list(Session *session, Table_ident *table, |
77.1.7
by Monty Taylor
Heap builds clean. |
288 |
LEX_STRING *alias, |
202
by Brian Aker
Cleanup sql_lex to modern types. |
289 |
uint32_t table_options, |
77.1.7
by Monty Taylor
Heap builds clean. |
290 |
thr_lock_type flags= TL_UNLOCK, |
291 |
List<Index_hint> *hints= 0, |
|
1
by brian
clean slate |
292 |
LEX_STRING *option= 0); |
644
by Brian Aker
Clean up warnings for Solaris. |
293 |
virtual void set_lock_for_tables(thr_lock_type) |
77.1.7
by Monty Taylor
Heap builds clean. |
294 |
{}
|
1
by brian
clean slate |
295 |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
296 |
friend class Select_Lex_Unit; |
575.4.7
by Monty Taylor
More header cleanup. |
297 |
friend bool mysql_new_select(LEX *lex, bool move_down); |
1
by brian
clean slate |
298 |
private: |
299 |
void fast_exclude(); |
|
300 |
};
|
|
301 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
302 |
/*
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
303 |
Select_Lex_Unit - unit of selects (UNION, INTERSECT, ...) group
|
846
by Brian Aker
Removing on typedeffed class. |
304 |
Select_Lexs
|
1
by brian
clean slate |
305 |
*/
|
520.1.21
by Brian Aker
THD -> Session rename |
306 |
class Session; |
1
by brian
clean slate |
307 |
class select_result; |
308 |
class JOIN; |
|
309 |
class select_union; |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
310 |
class Select_Lex_Unit: public Select_Lex_Node { |
1
by brian
clean slate |
311 |
protected: |
327.2.4
by Brian Aker
Refactoring table.h |
312 |
TableList result_table_list; |
1
by brian
clean slate |
313 |
select_union *union_result; |
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
314 |
Table *table; /* temporary table using for appending UNION results */ |
1
by brian
clean slate |
315 |
|
316 |
select_result *result; |
|
151
by Brian Aker
Ulonglong to uint64_t |
317 |
uint64_t found_rows_for_union; |
1
by brian
clean slate |
318 |
bool saved_error; |
319 |
||
320 |
public: |
|
321 |
bool prepared, // prepare phase already performed for UNION (unit) |
|
322 |
optimized, // optimize phase already performed for UNION (unit) |
|
323 |
executed, // already executed |
|
324 |
cleaned; |
|
325 |
||
326 |
// list of fields which points to temporary table for union
|
|
327 |
List<Item> item_list; |
|
328 |
/*
|
|
329 |
list of types of items inside union (used for union & derived tables)
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
330 |
|
1
by brian
clean slate |
331 |
Item_type_holders from which this list consist may have pointers to Field,
|
332 |
pointers is valid only after preparing SELECTS of this unit and before
|
|
333 |
any SELECT of this unit execution
|
|
334 |
||
335 |
TODO:
|
|
336 |
Possibly this member should be protected, and its direct use replaced
|
|
337 |
by get_unit_column_types(). Check the places where it is used.
|
|
338 |
*/
|
|
339 |
List<Item> types; |
|
340 |
/*
|
|
341 |
Pointer to 'last' select or pointer to unit where stored
|
|
342 |
global parameters for union
|
|
343 |
*/
|
|
846
by Brian Aker
Removing on typedeffed class. |
344 |
Select_Lex *global_parameters; |
1
by brian
clean slate |
345 |
//node on wich we should return current_select pointer after parsing subquery
|
846
by Brian Aker
Removing on typedeffed class. |
346 |
Select_Lex *return_to; |
1
by brian
clean slate |
347 |
/* LIMIT clause runtime counters */
|
348 |
ha_rows select_limit_cnt, offset_limit_cnt; |
|
349 |
/* not NULL if unit used in subselect, point to subselect item */
|
|
350 |
Item_subselect *item; |
|
351 |
/* thread handler */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
352 |
Session *session; |
1
by brian
clean slate |
353 |
/*
|
846
by Brian Aker
Removing on typedeffed class. |
354 |
Select_Lex for hidden SELECT in onion which process global
|
1
by brian
clean slate |
355 |
ORDER BY and LIMIT
|
356 |
*/
|
|
846
by Brian Aker
Removing on typedeffed class. |
357 |
Select_Lex *fake_select_lex; |
1
by brian
clean slate |
358 |
|
846
by Brian Aker
Removing on typedeffed class. |
359 |
Select_Lex *union_distinct; /* pointer to the last UNION DISTINCT */ |
1
by brian
clean slate |
360 |
bool describe; /* union exec() called for EXPLAIN */ |
361 |
||
362 |
void init_query(); |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
363 |
Select_Lex_Unit* master_unit(); |
846
by Brian Aker
Removing on typedeffed class. |
364 |
Select_Lex* outer_select(); |
365 |
Select_Lex* first_select() |
|
366 |
{
|
|
367 |
return reinterpret_cast<Select_Lex*>(slave); |
|
368 |
}
|
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
369 |
Select_Lex_Unit* next_unit() |
846
by Brian Aker
Removing on typedeffed class. |
370 |
{
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
371 |
return reinterpret_cast<Select_Lex_Unit*>(next); |
846
by Brian Aker
Removing on typedeffed class. |
372 |
}
|
373 |
Select_Lex* return_after_parsing() { return return_to; } |
|
1
by brian
clean slate |
374 |
void exclude_level(); |
375 |
void exclude_tree(); |
|
376 |
||
377 |
/* UNION methods */
|
|
892.2.4
by Monty Taylor
Fixed more warnings. |
378 |
bool prepare(Session *session, select_result *result, |
379 |
uint64_t additional_options); |
|
1
by brian
clean slate |
380 |
bool exec(); |
381 |
bool cleanup(); |
|
382 |
inline void unclean() { cleaned= 0; } |
|
383 |
void reinit_exec_mechanism(); |
|
384 |
||
385 |
void print(String *str, enum_query_type query_type); |
|
386 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
387 |
bool add_fake_select_lex(Session *session); |
388 |
void init_prepare_fake_select_lex(Session *session); |
|
1
by brian
clean slate |
389 |
bool change_result(select_result_interceptor *result, |
390 |
select_result_interceptor *old_result); |
|
846
by Brian Aker
Removing on typedeffed class. |
391 |
void set_limit(Select_Lex *values); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
392 |
void set_session(Session *session_arg) { session= session_arg; } |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
393 |
inline bool is_union (); |
1
by brian
clean slate |
394 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
395 |
friend void lex_start(Session *session); |
1
by brian
clean slate |
396 |
friend int subselect_union_engine::exec(); |
397 |
||
398 |
List<Item> *get_unit_column_types(); |
|
399 |
};
|
|
400 |
||
401 |
/*
|
|
846
by Brian Aker
Removing on typedeffed class. |
402 |
Select_Lex - store information of parsed SELECT statment
|
1
by brian
clean slate |
403 |
*/
|
847
by Brian Aker
More typdef class removal. |
404 |
class Select_Lex: public Select_Lex_Node |
1
by brian
clean slate |
405 |
{
|
406 |
public: |
|
407 |
Name_resolution_context context; |
|
408 |
char *db; |
|
1014.4.9
by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct |
409 |
/* An Item representing the WHERE clause */
|
410 |
Item *where; |
|
411 |
/* An Item representing the HAVING clause */
|
|
412 |
Item *having; |
|
1
by brian
clean slate |
413 |
/* Saved values of the WHERE and HAVING clauses*/
|
1014.4.9
by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct |
414 |
Item::cond_result cond_value; |
415 |
Item::cond_result having_value; |
|
1
by brian
clean slate |
416 |
/* point on lex in which it was created, used in view subquery detection */
|
575.4.7
by Monty Taylor
More header cleanup. |
417 |
LEX *parent_lex; |
1
by brian
clean slate |
418 |
enum olap_type olap; |
327.2.4
by Brian Aker
Refactoring table.h |
419 |
/* FROM clause - points to the beginning of the TableList::next_local list. */
|
1014.4.9
by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct |
420 |
SQL_LIST table_list; |
421 |
SQL_LIST group_list; /* GROUP BY clause. */ |
|
422 |
List<Item> item_list; /* list of fields & expressions */ |
|
423 |
List<String> interval_list; |
|
424 |
bool is_item_list_lookup; |
|
1
by brian
clean slate |
425 |
JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */ |
327.2.4
by Brian Aker
Refactoring table.h |
426 |
List<TableList> top_join_list; /* join list of the top level */ |
427 |
List<TableList> *join_list; /* list for the currently parsed join */ |
|
428 |
TableList *embedding; /* table embedding to the above list */ |
|
429 |
List<TableList> sj_nests; |
|
1
by brian
clean slate |
430 |
/*
|
431 |
Beginning of the list of leaves in a FROM clause, where the leaves
|
|
432 |
inlcude all base tables including view tables. The tables are connected
|
|
327.2.4
by Brian Aker
Refactoring table.h |
433 |
by TableList::next_leaf, so leaf_tables points to the left-most leaf.
|
1
by brian
clean slate |
434 |
*/
|
327.2.4
by Brian Aker
Refactoring table.h |
435 |
TableList *leaf_tables; |
1237.13.30
by Padraig O'Sullivan
Corrected a valgrind warning due to using std::string in the Select_Lex class whose memory is |
436 |
enum drizzled::optimizer::select_type type; /* type of select for EXPLAIN */ |
1
by brian
clean slate |
437 |
|
438 |
SQL_LIST order_list; /* ORDER clause */ |
|
439 |
SQL_LIST *gorder_list; |
|
440 |
Item *select_limit, *offset_limit; /* LIMIT clause parameters */ |
|
1014.4.9
by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct |
441 |
/* Arrays of pointers to top elements of all_fields list */
|
1
by brian
clean slate |
442 |
Item **ref_pointer_array; |
443 |
||
444 |
/*
|
|
445 |
number of items in select_list and HAVING clause used to get number
|
|
446 |
bigger then can be number of entries that will be added to all item
|
|
447 |
list during split_sum_func
|
|
448 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
449 |
uint32_t select_n_having_items; |
450 |
uint32_t cond_count; /* number of arguments of and/or/xor in where/having/on */ |
|
451 |
uint32_t between_count; /* number of between predicates in where/having/on */ |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
452 |
uint32_t max_equal_elems; /* maximal number of elements in multiple equalities */ |
1
by brian
clean slate |
453 |
/*
|
454 |
Number of fields used in select list or where clause of current select
|
|
455 |
and all inner subselects.
|
|
456 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
457 |
uint32_t select_n_where_fields; |
1
by brian
clean slate |
458 |
enum_parsing_place parsing_place; /* where we are parsing expression */ |
459 |
bool with_sum_func; /* sum function indicator */ |
|
460 |
||
202
by Brian Aker
Cleanup sql_lex to modern types. |
461 |
uint32_t table_join_options; |
462 |
uint32_t in_sum_expr; |
|
463 |
uint32_t select_number; /* number of select (used for EXPLAIN) */ |
|
937.2.6
by Stewart Smith
make set_if_bigger typesafe for C and C++. Fix up everywhere. |
464 |
int8_t nest_level; /* nesting level of select */ |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
465 |
Item_sum *inner_sum_func_list; /* list of sum func in nested selects */ |
202
by Brian Aker
Cleanup sql_lex to modern types. |
466 |
uint32_t with_wild; /* item list contain '*' */ |
1014.4.9
by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct |
467 |
bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ |
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
468 |
/* true when having fix field called in processing of this SELECT */
|
1
by brian
clean slate |
469 |
bool having_fix_field; |
470 |
/* List of references to fields referenced from inner selects */
|
|
471 |
List<Item_outer_ref> inner_refs_list; |
|
472 |
/* Number of Item_sum-derived objects in this SELECT */
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
473 |
uint32_t n_sum_items; |
1
by brian
clean slate |
474 |
/* Number of Item_sum-derived objects in children and descendant SELECTs */
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
475 |
uint32_t n_child_sum_items; |
1
by brian
clean slate |
476 |
|
477 |
/* explicit LIMIT clause was used */
|
|
478 |
bool explicit_limit; |
|
479 |
/*
|
|
480 |
there are subquery in HAVING clause => we can't close tables before
|
|
481 |
query processing end even if we use temporary table
|
|
482 |
*/
|
|
483 |
bool subquery_in_having; |
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
484 |
/* true <=> this SELECT is correlated w.r.t. some ancestor select */
|
1
by brian
clean slate |
485 |
bool is_correlated; |
486 |
/* exclude this select from check of unique_table() */
|
|
487 |
bool exclude_from_table_unique_test; |
|
488 |
/* List of fields that aren't under an aggregate function */
|
|
489 |
List<Item_field> non_agg_fields; |
|
490 |
/* index in the select list of the expression currently being fixed */
|
|
491 |
int cur_pos_in_select_list; |
|
492 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
493 |
/*
|
1
by brian
clean slate |
494 |
This is a copy of the original JOIN USING list that comes from
|
495 |
the parser. The parser :
|
|
327.2.4
by Brian Aker
Refactoring table.h |
496 |
1. Sets the natural_join of the second TableList in the join
|
846
by Brian Aker
Removing on typedeffed class. |
497 |
and the Select_Lex::prev_join_using.
|
327.2.4
by Brian Aker
Refactoring table.h |
498 |
2. Makes a parent TableList and sets its is_natural_join/
|
1
by brian
clean slate |
499 |
join_using_fields members.
|
327.2.4
by Brian Aker
Refactoring table.h |
500 |
3. Uses the wrapper TableList as a table in the upper level.
|
1
by brian
clean slate |
501 |
We cannot assign directly to join_using_fields in the parser because
|
327.2.4
by Brian Aker
Refactoring table.h |
502 |
at stage (1.) the parent TableList is not constructed yet and
|
1
by brian
clean slate |
503 |
the assignment will override the JOIN USING fields of the lower level
|
504 |
joins on the right.
|
|
505 |
*/
|
|
506 |
List<String> *prev_join_using; |
|
507 |
/*
|
|
508 |
Bitmap used in the ONLY_FULL_GROUP_BY_MODE to prevent mixture of aggregate
|
|
509 |
functions and non aggregated fields when GROUP BY list is absent.
|
|
510 |
Bits:
|
|
511 |
0 - non aggregated fields are used in this select,
|
|
512 |
defined as NON_AGG_FIELD_USED.
|
|
513 |
1 - aggregate functions are used in this select,
|
|
514 |
defined as SUM_FUNC_USED.
|
|
515 |
*/
|
|
1089.6.3
by Padraig O'Sullivan
Replaced an instance where a uint8_t type was being used to hold a |
516 |
std::bitset<2> full_group_by_flag; |
1
by brian
clean slate |
517 |
void init_query(); |
518 |
void init_select(); |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
519 |
Select_Lex_Unit* master_unit(); |
520 |
Select_Lex_Unit* first_inner_unit() |
|
846
by Brian Aker
Removing on typedeffed class. |
521 |
{
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
522 |
return (Select_Lex_Unit*) slave; |
846
by Brian Aker
Removing on typedeffed class. |
523 |
}
|
524 |
Select_Lex* outer_select(); |
|
1014.4.9
by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct |
525 |
Select_Lex* next_select() |
526 |
{
|
|
527 |
return (Select_Lex*) next; |
|
528 |
}
|
|
846
by Brian Aker
Removing on typedeffed class. |
529 |
Select_Lex* next_select_in_list() |
530 |
{
|
|
531 |
return (Select_Lex*) link_next; |
|
532 |
}
|
|
847
by Brian Aker
More typdef class removal. |
533 |
Select_Lex_Node** next_select_in_list_addr() |
1
by brian
clean slate |
534 |
{
|
535 |
return &link_next; |
|
536 |
}
|
|
846
by Brian Aker
Removing on typedeffed class. |
537 |
Select_Lex* return_after_parsing() |
1
by brian
clean slate |
538 |
{
|
539 |
return master_unit()->return_after_parsing(); |
|
540 |
}
|
|
541 |
||
846
by Brian Aker
Removing on typedeffed class. |
542 |
void mark_as_dependent(Select_Lex *last); |
1
by brian
clean slate |
543 |
|
544 |
bool set_braces(bool value); |
|
545 |
bool inc_in_sum_expr(); |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
546 |
uint32_t get_in_sum_expr(); |
1
by brian
clean slate |
547 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
548 |
bool add_item_to_list(Session *session, Item *item); |
549 |
bool add_group_to_list(Session *session, Item *item, bool asc); |
|
550 |
bool add_order_to_list(Session *session, Item *item, bool asc); |
|
1027
by Brian Aker
Merge Jay |
551 |
TableList* add_table_to_list(Session *session, |
552 |
Table_ident *table, |
|
553 |
LEX_STRING *alias, |
|
554 |
uint32_t table_options, |
|
555 |
thr_lock_type flags= TL_UNLOCK, |
|
556 |
List<Index_hint> *hints= 0, |
|
557 |
LEX_STRING *option= 0); |
|
327.2.4
by Brian Aker
Refactoring table.h |
558 |
TableList* get_table_list(); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
559 |
bool init_nested_join(Session *session); |
560 |
TableList *end_nested_join(Session *session); |
|
561 |
TableList *nest_last_join(Session *session); |
|
327.2.4
by Brian Aker
Refactoring table.h |
562 |
void add_joined_table(TableList *table); |
563 |
TableList *convert_right_join(); |
|
1
by brian
clean slate |
564 |
List<Item>* get_item_list(); |
202
by Brian Aker
Cleanup sql_lex to modern types. |
565 |
uint32_t get_table_join_options(); |
1
by brian
clean slate |
566 |
void set_lock_for_tables(thr_lock_type lock_type); |
567 |
inline void init_order() |
|
568 |
{
|
|
569 |
order_list.elements= 0; |
|
570 |
order_list.first= 0; |
|
481
by Brian Aker
Remove all of uchar. |
571 |
order_list.next= (unsigned char**) &order_list.first; |
1
by brian
clean slate |
572 |
}
|
573 |
/*
|
|
574 |
This method created for reiniting LEX in mysql_admin_table() and can be
|
|
846
by Brian Aker
Removing on typedeffed class. |
575 |
used only if you are going remove all Select_Lex & units except belonger
|
1
by brian
clean slate |
576 |
to LEX (LEX::unit & LEX::select, for other purposes there are
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
577 |
Select_Lex_Unit::exclude_level & Select_Lex_Unit::exclude_tree
|
1
by brian
clean slate |
578 |
*/
|
1014.4.9
by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct |
579 |
void cut_subtree() |
580 |
{
|
|
581 |
slave= 0; |
|
582 |
}
|
|
1
by brian
clean slate |
583 |
bool test_limit(); |
584 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
585 |
friend void lex_start(Session *session); |
846
by Brian Aker
Removing on typedeffed class. |
586 |
Select_Lex() : n_sum_items(0), n_child_sum_items(0) {} |
1
by brian
clean slate |
587 |
void make_empty_select() |
588 |
{
|
|
589 |
init_query(); |
|
590 |
init_select(); |
|
591 |
}
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
592 |
bool setup_ref_array(Session *session, uint32_t order_group_num); |
593 |
void print(Session *session, String *str, enum_query_type query_type); |
|
1
by brian
clean slate |
594 |
static void print_order(String *str, |
327.2.3
by Brian Aker
Refactoring of class Table |
595 |
order_st *order, |
1
by brian
clean slate |
596 |
enum_query_type query_type); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
597 |
void print_limit(Session *session, String *str, enum_query_type query_type); |
598 |
void fix_prepare_information(Session *session, Item **conds, Item **having_conds); |
|
1
by brian
clean slate |
599 |
/*
|
600 |
Destroy the used execution plan (JOIN) of this subtree (this
|
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
601 |
Select_Lex and all nested Select_Lexes and Select_Lex_Units).
|
1
by brian
clean slate |
602 |
*/
|
603 |
bool cleanup(); |
|
604 |
/*
|
|
605 |
Recursively cleanup the join of this select lex and of all nested
|
|
606 |
select lexes.
|
|
607 |
*/
|
|
608 |
void cleanup_all_joins(bool full); |
|
609 |
||
610 |
void set_index_hint_type(enum index_hint_type type, index_clause_map clause); |
|
611 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
612 |
/*
|
1
by brian
clean slate |
613 |
Add a index hint to the tagged list of hints. The type and clause of the
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
614 |
hint will be the current ones (set by set_index_hint())
|
1
by brian
clean slate |
615 |
*/
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
616 |
bool add_index_hint (Session *session, char *str, uint32_t length); |
1
by brian
clean slate |
617 |
|
618 |
/* make a list to hold index hints */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
619 |
void alloc_index_hints (Session *session); |
1
by brian
clean slate |
620 |
/* read and clear the index hints */
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
621 |
List<Index_hint>* pop_index_hints(void) |
1
by brian
clean slate |
622 |
{
|
623 |
List<Index_hint> *hints= index_hints; |
|
624 |
index_hints= NULL; |
|
625 |
return hints; |
|
626 |
}
|
|
627 |
||
628 |
void clear_index_hints(void) { index_hints= NULL; } |
|
629 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
630 |
private: |
1
by brian
clean slate |
631 |
/* current index hint kind. used in filling up index_hints */
|
632 |
enum index_hint_type current_index_hint_type; |
|
633 |
index_clause_map current_index_hint_clause; |
|
634 |
/* a list of USE/FORCE/IGNORE INDEX */
|
|
635 |
List<Index_hint> *index_hints; |
|
636 |
};
|
|
637 |
||
848
by Brian Aker
typdef class removal (just... use the name of the class). |
638 |
inline bool Select_Lex_Unit::is_union () |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
639 |
{
|
640 |
return first_select()->next_select() && |
|
1
by brian
clean slate |
641 |
first_select()->next_select()->linkage == UNION_TYPE; |
642 |
}
|
|
643 |
||
1014.4.9
by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct |
644 |
enum xa_option_words |
645 |
{
|
|
646 |
XA_NONE
|
|
647 |
, XA_JOIN |
|
648 |
, XA_RESUME |
|
649 |
, XA_ONE_PHASE |
|
650 |
, XA_SUSPEND |
|
651 |
, XA_FOR_MIGRATE |
|
652 |
};
|
|
1
by brian
clean slate |
653 |
|
654 |
extern const LEX_STRING null_lex_str; |
|
655 |
||
656 |
/*
|
|
657 |
Class representing list of all tables used by statement.
|
|
658 |
It also contains information about stored functions used by statement
|
|
659 |
since during its execution we may have to add all tables used by its
|
|
660 |
stored functions/triggers to this list in order to pre-open and lock
|
|
661 |
them.
|
|
662 |
||
663 |
Also used by st_lex::reset_n_backup/restore_backup_query_tables_list()
|
|
664 |
methods to save and restore this information.
|
|
665 |
*/
|
|
666 |
class Query_tables_list |
|
667 |
{
|
|
668 |
public: |
|
669 |
/* Global list of all tables used by this statement */
|
|
327.2.4
by Brian Aker
Refactoring table.h |
670 |
TableList *query_tables; |
1
by brian
clean slate |
671 |
/* Pointer to next_global member of last element in the previous list. */
|
327.2.4
by Brian Aker
Refactoring table.h |
672 |
TableList **query_tables_last; |
1
by brian
clean slate |
673 |
/*
|
674 |
If non-0 then indicates that query requires prelocking and points to
|
|
675 |
next_global member of last own element in query table list (i.e. last
|
|
676 |
table which was not added to it as part of preparation to prelocking).
|
|
677 |
0 - indicates that this query does not need prelocking.
|
|
678 |
*/
|
|
327.2.4
by Brian Aker
Refactoring table.h |
679 |
TableList **query_tables_own_last; |
1
by brian
clean slate |
680 |
|
681 |
/*
|
|
682 |
These constructor and destructor serve for creation/destruction
|
|
683 |
of Query_tables_list instances which are used as backup storage.
|
|
684 |
*/
|
|
685 |
Query_tables_list() {} |
|
1240.9.3
by Monty Taylor
remark #444: destructor for base class "Query_tables_list" (declared at line 656) is not virtual |
686 |
virtual ~Query_tables_list() {} |
1
by brian
clean slate |
687 |
|
688 |
/* Initializes (or resets) Query_tables_list object for "real" use. */
|
|
689 |
void reset_query_tables_list(bool init); |
|
690 |
||
691 |
/*
|
|
692 |
Direct addition to the list of query tables.
|
|
693 |
If you are using this function, you must ensure that the table
|
|
694 |
object, in particular table->db member, is initialized.
|
|
695 |
*/
|
|
327.2.4
by Brian Aker
Refactoring table.h |
696 |
void add_to_query_tables(TableList *table) |
1
by brian
clean slate |
697 |
{
|
698 |
*(table->prev_global= query_tables_last)= table; |
|
699 |
query_tables_last= &table->next_global; |
|
700 |
}
|
|
701 |
/* Return pointer to first not-own table in query-tables or 0 */
|
|
327.2.4
by Brian Aker
Refactoring table.h |
702 |
TableList* first_not_own_table() |
1
by brian
clean slate |
703 |
{
|
704 |
return ( query_tables_own_last ? *query_tables_own_last : 0); |
|
705 |
}
|
|
706 |
void chop_off_not_own_tables() |
|
707 |
{
|
|
708 |
if (query_tables_own_last) |
|
709 |
{
|
|
710 |
*query_tables_own_last= 0; |
|
711 |
query_tables_last= query_tables_own_last; |
|
712 |
query_tables_own_last= 0; |
|
713 |
}
|
|
714 |
}
|
|
715 |
};
|
|
716 |
||
717 |
/**
|
|
718 |
The state of the lexical parser, when parsing comments.
|
|
719 |
*/
|
|
720 |
enum enum_comment_state |
|
721 |
{
|
|
722 |
/**
|
|
723 |
Not parsing comments.
|
|
724 |
*/
|
|
725 |
NO_COMMENT, |
|
726 |
/**
|
|
727 |
Parsing comments that need to be preserved.
|
|
728 |
Typically, these are user comments '/' '*' ... '*' '/'.
|
|
729 |
*/
|
|
730 |
PRESERVE_COMMENT, |
|
731 |
/**
|
|
732 |
Parsing comments that need to be discarded.
|
|
733 |
Typically, these are special comments '/' '*' '!' ... '*' '/',
|
|
734 |
or '/' '*' '!' 'M' 'M' 'm' 'm' 'm' ... '*' '/', where the comment
|
|
735 |
markers should not be expanded.
|
|
736 |
*/
|
|
737 |
DISCARD_COMMENT
|
|
738 |
};
|
|
739 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
740 |
} /* namespace drizzled */ |
741 |
||
1014.4.8
by Jay Pipes
Split Lex_input_stream out into its own header. |
742 |
#include "drizzled/lex_input_stream.h" |
1
by brian
clean slate |
743 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
744 |
namespace drizzled |
745 |
{
|
|
746 |
||
520.1.21
by Brian Aker
THD -> Session rename |
747 |
/* The state of the lex parsing. This is saved in the Session struct */
|
575.4.7
by Monty Taylor
More header cleanup. |
748 |
class LEX : public Query_tables_list |
1
by brian
clean slate |
749 |
{
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
750 |
public: |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
751 |
Select_Lex_Unit unit; /* most upper unit */ |
846
by Brian Aker
Removing on typedeffed class. |
752 |
Select_Lex select_lex; /* first Select_Lex */ |
753 |
/* current Select_Lex in parsing */
|
|
754 |
Select_Lex *current_select; |
|
755 |
/* list of all Select_Lex */
|
|
756 |
Select_Lex *all_selects_list; |
|
1
by brian
clean slate |
757 |
|
1014.4.5
by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables. |
758 |
/* This is the "scale" for DECIMAL (S,P) notation */
|
759 |
char *length; |
|
760 |
/* This is the decimal precision in DECIMAL(S,P) notation */
|
|
761 |
char *dec; |
|
762 |
||
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
763 |
/**
|
764 |
* This is used kind of like the "ident" member variable below, as
|
|
765 |
* a place to store certain names of identifiers. Unfortunately, it
|
|
766 |
* is used differently depending on the Command (SELECT on a derived
|
|
767 |
* table vs CREATE)
|
|
768 |
*/
|
|
1
by brian
clean slate |
769 |
LEX_STRING name; |
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
770 |
/* The string literal used in a LIKE expression */
|
1
by brian
clean slate |
771 |
String *wild; |
831.1.2
by Brian Aker
Rename class file_exchange |
772 |
file_exchange *exchange; |
1
by brian
clean slate |
773 |
select_result *result; |
1014.4.5
by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables. |
774 |
|
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
775 |
/**
|
776 |
* This is current used to store the name of a named key cache
|
|
777 |
* or a named savepoint. It should probably be refactored out into
|
|
778 |
* the eventual Command class built for the Keycache and Savepoint
|
|
779 |
* commands.
|
|
780 |
*/
|
|
1014.4.5
by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables. |
781 |
LEX_STRING ident; |
782 |
||
481
by Brian Aker
Remove all of uchar. |
783 |
unsigned char* yacc_yyss, *yacc_yyvs; |
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
784 |
/* The owning Session of this LEX */
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
785 |
Session *session; |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
786 |
const CHARSET_INFO *charset; |
1
by brian
clean slate |
787 |
bool text_string_is_7bit; |
788 |
/* store original leaf_tables for INSERT SELECT and PS/SP */
|
|
327.2.4
by Brian Aker
Refactoring table.h |
789 |
TableList *leaf_tables_insert; |
1
by brian
clean slate |
790 |
|
791 |
List<Key_part_spec> col_list; |
|
792 |
List<Key_part_spec> ref_list; |
|
793 |
List<String> interval_list; |
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
794 |
List<Lex_Column> columns; |
1
by brian
clean slate |
795 |
List<Item> *insert_list,field_list,value_list,update_list; |
796 |
List<List_item> many_values; |
|
797 |
List<set_var_base> var_list; |
|
798 |
/*
|
|
799 |
A stack of name resolution contexts for the query. This stack is used
|
|
800 |
at parse time to set local name resolution contexts for various parts
|
|
801 |
of a query. For example, in a JOIN ... ON (some_condition) clause the
|
|
802 |
Items in 'some_condition' must be resolved only against the operands
|
|
803 |
of the the join, and not against the whole clause. Similarly, Items in
|
|
804 |
subqueries should be resolved against the subqueries (and outer queries).
|
|
805 |
The stack is used in the following way: when the parser detects that
|
|
806 |
all Items in some clause need a local context, it creates a new context
|
|
807 |
and pushes it on the stack. All newly created Items always store the
|
|
808 |
top-most context in the stack. Once the parser leaves the clause that
|
|
809 |
required a local context, the parser pops the top-most context.
|
|
810 |
*/
|
|
811 |
List<Name_resolution_context> context_stack; |
|
812 |
||
1014.4.5
by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables. |
813 |
SQL_LIST auxiliary_table_list; |
814 |
SQL_LIST save_list; |
|
1052.2.3
by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards. |
815 |
CreateField *last_field; |
1
by brian
clean slate |
816 |
Item_sum *in_sum_func; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
817 |
plugin::Function *udf; |
202
by Brian Aker
Cleanup sql_lex to modern types. |
818 |
uint32_t type; |
1
by brian
clean slate |
819 |
/*
|
820 |
This variable is used in post-parse stage to declare that sum-functions,
|
|
821 |
or functions which have sense only if GROUP BY is present, are allowed.
|
|
822 |
For example in a query
|
|
823 |
SELECT ... FROM ...WHERE MIN(i) == 1 GROUP BY ... HAVING MIN(i) > 2
|
|
824 |
MIN(i) in the WHERE clause is not allowed in the opposite to MIN(i)
|
|
825 |
in the HAVING clause. Due to possible nesting of select construct
|
|
826 |
the variable can contain 0 or 1 for each nest level.
|
|
827 |
*/
|
|
828 |
nesting_map allow_sum_func; |
|
829 |
enum_sql_command sql_command; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
830 |
statement::Statement *statement; |
1
by brian
clean slate |
831 |
/*
|
832 |
Usually `expr` rule of yacc is quite reused but some commands better
|
|
833 |
not support subqueries which comes standard with this rule, like
|
|
834 |
KILL, HA_READ, CREATE/ALTER EVENT etc. Set this to `false` to get
|
|
835 |
syntax error back.
|
|
836 |
*/
|
|
837 |
bool expr_allows_subselect; |
|
838 |
||
839 |
thr_lock_type lock_option; |
|
840 |
enum enum_duplicates duplicates; |
|
841 |
union { |
|
842 |
enum ha_rkey_function ha_rkey_mode; |
|
843 |
enum xa_option_words xa_opt; |
|
844 |
};
|
|
845 |
enum enum_var_type option_type; |
|
846 |
||
847 |
int nest_level; |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
848 |
uint8_t describe; |
1
by brian
clean slate |
849 |
/*
|
850 |
A flag that indicates what kinds of derived tables are present in the
|
|
851 |
query (0 if no derived tables, otherwise DERIVED_SUBQUERY).
|
|
852 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
853 |
uint8_t derived_tables; |
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
854 |
|
1014.4.6
by Jay Pipes
Remove useless autocommit member variable of LEX. Was always 0. Removed a useless conditional in mysql_execute_command. Document the 'verbose' member variable of LEX |
855 |
/* Only true when FULL symbol is found (e.g. SHOW FULL PROCESSLIST) */
|
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
856 |
bool verbose; |
1014.4.5
by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables. |
857 |
|
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
858 |
/* Was the IGNORE symbol found in statement */
|
1014.4.5
by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables. |
859 |
bool ignore; |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
860 |
|
1
by brian
clean slate |
861 |
/**
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
862 |
During name resolution search only in the table list given by
|
1
by brian
clean slate |
863 |
Name_resolution_context::first_name_resolution_table and
|
864 |
Name_resolution_context::last_name_resolution_table
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
865 |
(see Item_field::fix_fields()).
|
1
by brian
clean slate |
866 |
*/
|
867 |
bool use_only_table_context; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
868 |
|
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
869 |
/* Was the ESCAPE keyword used? */
|
1
by brian
clean slate |
870 |
bool escape_used; |
871 |
bool is_lex_started; /* If lex_start() did run. For debugging. */ |
|
872 |
||
575.4.7
by Monty Taylor
More header cleanup. |
873 |
LEX(); |
1
by brian
clean slate |
874 |
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
875 |
/* Note that init and de-init mostly happen in lex_start and lex_end
|
876 |
and not here. This is because LEX isn't delete/new for each new
|
|
877 |
statement in a session. It's re-used by doing lex_end, lex_start
|
|
878 |
in sql_lex.cc
|
|
879 |
*/
|
|
575.4.7
by Monty Taylor
More header cleanup. |
880 |
virtual ~LEX() |
1
by brian
clean slate |
881 |
{
|
882 |
}
|
|
883 |
||
327.2.4
by Brian Aker
Refactoring table.h |
884 |
TableList *unlink_first_table(bool *link_to_local); |
885 |
void link_first_table_back(TableList *first, bool link_to_local); |
|
1
by brian
clean slate |
886 |
void first_lists_tables_same(); |
887 |
||
888 |
bool only_view_structure(); |
|
889 |
bool need_correct_ident(); |
|
890 |
||
891 |
void cleanup_after_one_table_open(); |
|
892 |
||
893 |
bool push_context(Name_resolution_context *context) |
|
894 |
{
|
|
895 |
return context_stack.push_front(context); |
|
896 |
}
|
|
897 |
||
898 |
void pop_context() |
|
899 |
{
|
|
900 |
context_stack.pop(); |
|
901 |
}
|
|
902 |
||
903 |
bool copy_db_to(char **p_db, size_t *p_db_length) const; |
|
904 |
||
905 |
Name_resolution_context *current_context() |
|
906 |
{
|
|
907 |
return context_stack.head(); |
|
908 |
}
|
|
909 |
/*
|
|
520.1.21
by Brian Aker
THD -> Session rename |
910 |
Restore the LEX and Session in case of a parse error.
|
1
by brian
clean slate |
911 |
*/
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
912 |
static void cleanup_lex_after_parse_error(Session *session); |
1
by brian
clean slate |
913 |
|
914 |
/**
|
|
915 |
@brief check if the statement is a single-level join
|
|
916 |
@return result of the check
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
917 |
@retval true The statement doesn't contain subqueries, unions and
|
1
by brian
clean slate |
918 |
stored procedure calls.
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
919 |
@retval false There are subqueries, UNIONs or stored procedure calls.
|
1
by brian
clean slate |
920 |
*/
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
921 |
bool is_single_level_stmt() |
922 |
{
|
|
923 |
/*
|
|
1
by brian
clean slate |
924 |
This check exploits the fact that the last added to all_select_list is
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
925 |
on its top. So select_lex (as the first added) will be at the tail
|
1
by brian
clean slate |
926 |
of the list.
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
927 |
*/
|
628
by Brian Aker
Collection of dead code removal |
928 |
if (&select_lex == all_selects_list) |
1
by brian
clean slate |
929 |
{
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
930 |
assert(!all_selects_list->next_select_in_list()); |
931 |
return true; |
|
1
by brian
clean slate |
932 |
}
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
933 |
return false; |
1
by brian
clean slate |
934 |
}
|
575.4.7
by Monty Taylor
More header cleanup. |
935 |
};
|
1
by brian
clean slate |
936 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
937 |
extern void lex_start(Session *session); |
1
by brian
clean slate |
938 |
extern void lex_end(LEX *lex); |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
939 |
extern void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str); |
1
by brian
clean slate |
940 |
extern bool is_lex_native_function(const LEX_STRING *name); |
941 |
||
942 |
/**
|
|
943 |
@} (End of group Semantic_Analysis)
|
|
944 |
*/
|
|
945 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
946 |
} /* namespace drizzled */ |
947 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
948 |
#endif /* DRIZZLE_SERVER */ |
1014.4.1
by Jay Pipes
Cosmetic: make sql_lex.h include guard match rest of drizzled/ headers. |
949 |
#endif /* DRIZZLED_SQL_LEX_H */ |