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 |
*/
|
|
934.2.1
by Jay Pipes
Split index hints out into their own file, removal from sql_lex.h and sql_select.cc |
26 |
#include "drizzled/sql_udf.h" |
27 |
#include "drizzled/name_resolution_context.h" |
|
28 |
#include "drizzled/item/subselect.h" |
|
29 |
#include "drizzled/item/param.h" |
|
30 |
#include "drizzled/item/outer_ref.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" |
|
35 |
#include "drizzled/key.h" |
|
36 |
#include "drizzled/foreign_key.h" |
|
37 |
#include "drizzled/item/param.h" |
|
38 |
#include "drizzled/index_hint.h" |
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
39 |
|
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
40 |
class select_result_interceptor; |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
41 |
|
1
by brian
clean slate |
42 |
/* YACC and LEX Definitions */
|
43 |
||
44 |
/* These may not be declared yet */
|
|
45 |
class Table_ident; |
|
831.1.2
by Brian Aker
Rename class file_exchange |
46 |
class file_exchange; |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
47 |
class Lex_Column; |
675
by Brian Aker
Cleanup around item includes. |
48 |
class Item_outer_ref; |
1
by brian
clean slate |
49 |
|
50 |
/*
|
|
51 |
The following hack is needed because mysql_yacc.cc does not define
|
|
52 |
YYSTYPE before including this file
|
|
53 |
*/
|
|
54 |
||
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
55 |
#ifdef DRIZZLE_SERVER
|
56 |
# include <drizzled/set_var.h>
|
|
57 |
# include <drizzled/item/func.h>
|
|
58 |
# ifdef DRIZZLE_YACC
|
|
59 |
# define LEX_YYSTYPE void *
|
|
60 |
# else
|
|
61 |
# if defined(DRIZZLE_LEX)
|
|
62 |
# include <drizzled/lex_symbol.h>
|
|
63 |
# include <drizzled/sql_yacc.h>
|
|
64 |
# define LEX_YYSTYPE YYSTYPE *
|
|
65 |
# else
|
|
66 |
# define LEX_YYSTYPE void *
|
|
67 |
# endif /* defined(DRIZZLE_LEX) */ |
|
68 |
# endif /* DRIZZLE_YACC */ |
|
69 |
#endif /* DRIZZLE_SERVER */ |
|
1
by brian
clean slate |
70 |
|
71 |
// describe/explain types
|
|
72 |
#define DESCRIBE_NORMAL 1
|
|
73 |
#define DESCRIBE_EXTENDED 2
|
|
74 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
75 |
#ifdef DRIZZLE_SERVER
|
1
by brian
clean slate |
76 |
|
77 |
#define DERIVED_NONE 0
|
|
78 |
#define DERIVED_SUBQUERY 1
|
|
79 |
||
80 |
typedef List<Item> List_item; |
|
81 |
||
82 |
/* SERVERS CACHE CHANGES */
|
|
83 |
typedef struct st_lex_server_options |
|
84 |
{
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
85 |
int32_t port; |
86 |
uint32_t server_name_length; |
|
185
by Brian Aker
More dead code baby... it has become a little like drilling for oil. Alaska |
87 |
char *server_name, *host, *db, *username, *password, *scheme, *owner; |
1
by brian
clean slate |
88 |
} LEX_SERVER_OPTIONS; |
89 |
||
90 |
||
91 |
enum sub_select_type |
|
92 |
{
|
|
93 |
UNSPECIFIED_TYPE,UNION_TYPE, INTERSECT_TYPE, |
|
94 |
EXCEPT_TYPE, GLOBAL_OPTIONS_TYPE, DERIVED_TABLE_TYPE, OLAP_TYPE |
|
95 |
};
|
|
96 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
97 |
enum olap_type |
1
by brian
clean slate |
98 |
{
|
99 |
UNSPECIFIED_OLAP_TYPE, CUBE_TYPE, ROLLUP_TYPE |
|
100 |
};
|
|
101 |
||
102 |
enum tablespace_op_type |
|
103 |
{
|
|
104 |
NO_TABLESPACE_OP, DISCARD_TABLESPACE, IMPORT_TABLESPACE |
|
105 |
};
|
|
106 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
107 |
/*
|
108 |
The state of the lex parsing for selects
|
|
109 |
||
1
by brian
clean slate |
110 |
master and slaves are pointers to select_lex.
|
111 |
master is pointer to upper level node.
|
|
112 |
slave is pointer to lower level node
|
|
113 |
select_lex is a SELECT without union
|
|
114 |
unit is container of either
|
|
115 |
- One SELECT
|
|
116 |
- UNION of selects
|
|
117 |
select_lex and unit are both inherited form select_lex_node
|
|
118 |
neighbors are two select_lex or units on the same level
|
|
119 |
||
120 |
All select describing structures linked with following pointers:
|
|
121 |
- list of neighbors (next/prev) (prev of first element point to slave
|
|
122 |
pointer of upper structure)
|
|
123 |
- For select this is a list of UNION's (or one element list)
|
|
124 |
- For units this is a list of sub queries for the upper level select
|
|
125 |
||
126 |
- pointer to master (master), which is
|
|
127 |
If this is a unit
|
|
128 |
- pointer to outer select_lex
|
|
129 |
If this is a select_lex
|
|
130 |
- pointer to outer unit structure for select
|
|
131 |
||
132 |
- pointer to slave (slave), which is either:
|
|
133 |
If this is a unit:
|
|
134 |
- first SELECT that belong to this unit
|
|
135 |
If this is a select_lex
|
|
136 |
- first unit that belong to this SELECT (subquries or derived tables)
|
|
137 |
||
138 |
- list of all select_lex (link_next/link_prev)
|
|
139 |
This is to be used for things like derived tables creation, where we
|
|
140 |
go through this list and create the derived tables.
|
|
141 |
||
142 |
If unit contain several selects (UNION now, INTERSECT etc later)
|
|
143 |
then it have special select_lex called fake_select_lex. It used for
|
|
144 |
storing global parameters (like ORDER BY, LIMIT) and executing union.
|
|
145 |
Subqueries used in global ORDER BY clause will be attached to this
|
|
146 |
fake_select_lex, which will allow them correctly resolve fields of
|
|
147 |
'upper' UNION and outer selects.
|
|
148 |
||
149 |
For example for following query:
|
|
150 |
||
151 |
select *
|
|
152 |
from table1
|
|
153 |
where table1.field IN (select * from table1_1_1 union
|
|
154 |
select * from table1_1_2)
|
|
155 |
union
|
|
156 |
select *
|
|
157 |
from table2
|
|
158 |
where table2.field=(select (select f1 from table2_1_1_1_1
|
|
159 |
where table2_1_1_1_1.f2=table2_1_1.f3)
|
|
160 |
from table2_1_1
|
|
161 |
where table2_1_1.f1=table2.f2)
|
|
162 |
union
|
|
163 |
select * from table3;
|
|
164 |
||
165 |
we will have following structure:
|
|
166 |
||
167 |
select1: (select * from table1 ...)
|
|
168 |
select2: (select * from table2 ...)
|
|
169 |
select3: (select * from table3)
|
|
170 |
select1.1.1: (select * from table1_1_1)
|
|
171 |
...
|
|
172 |
||
173 |
main unit
|
|
174 |
fake0
|
|
175 |
select1 select2 select3
|
|
176 |
|^^ |^
|
|
177 |
s||| ||master
|
|
178 |
l||| |+---------------------------------+
|
|
179 |
a||| +---------------------------------+|
|
|
180 |
v|||master slave ||
|
|
181 |
e||+-------------------------+ ||
|
|
182 |
V| neighbor | V|
|
|
183 |
unit1.1<+==================>unit1.2 unit2.1
|
|
184 |
fake1.1
|
|
185 |
select1.1.1 select 1.1.2 select1.2.1 select2.1.1
|
|
186 |
|^
|
|
187 |
||
|
|
188 |
V|
|
|
189 |
unit2.1.1.1
|
|
190 |
select2.1.1.1.1
|
|
191 |
||
192 |
||
193 |
relation in main unit will be following:
|
|
194 |
(bigger picture for:
|
|
195 |
main unit
|
|
196 |
fake0
|
|
197 |
select1 select2 select3
|
|
198 |
in the above picture)
|
|
199 |
||
200 |
main unit
|
|
201 |
|^^^^|fake_select_lex
|
|
202 |
|||||+--------------------------------------------+
|
|
203 |
||||+--------------------------------------------+|
|
|
204 |
|||+------------------------------+ ||
|
|
205 |
||+--------------+ | ||
|
|
206 |
slave||master | | ||
|
|
207 |
V| neighbor | neighbor | master|V
|
|
208 |
select1<========>select2<========>select3 fake0
|
|
209 |
||
210 |
list of all select_lex will be following (as it will be constructed by
|
|
211 |
parser):
|
|
212 |
||
213 |
select1->select2->select3->select2.1.1->select 2.1.2->select2.1.1.1.1-+
|
|
214 |
|
|
|
215 |
+---------------------------------------------------------------------+
|
|
216 |
|
|
|
217 |
+->select1.1.1->select1.1.2
|
|
218 |
||
219 |
*/
|
|
220 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
221 |
/*
|
846
by Brian Aker
Removing on typedeffed class. |
222 |
Base class for Select_Lex (Select_Lex) &
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
223 |
Select_Lex_Unit (Select_Lex_Unit)
|
1
by brian
clean slate |
224 |
*/
|
575.4.7
by Monty Taylor
More header cleanup. |
225 |
class LEX; |
846
by Brian Aker
Removing on typedeffed class. |
226 |
class Select_Lex; |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
227 |
class Select_Lex_Unit; |
847
by Brian Aker
More typdef class removal. |
228 |
class Select_Lex_Node { |
1
by brian
clean slate |
229 |
protected: |
847
by Brian Aker
More typdef class removal. |
230 |
Select_Lex_Node *next, **prev, /* neighbor list */ |
1
by brian
clean slate |
231 |
*master, *slave, /* vertical links */ |
846
by Brian Aker
Removing on typedeffed class. |
232 |
*link_next, **link_prev; /* list of whole Select_Lex */ |
1
by brian
clean slate |
233 |
public: |
234 |
||
151
by Brian Aker
Ulonglong to uint64_t |
235 |
uint64_t options; |
1
by brian
clean slate |
236 |
|
237 |
/*
|
|
238 |
result of this query can't be cached, bit field, can be :
|
|
239 |
UNCACHEABLE_DEPENDENT
|
|
240 |
UNCACHEABLE_RAND
|
|
241 |
UNCACHEABLE_SIDEEFFECT
|
|
242 |
UNCACHEABLE_EXPLAIN
|
|
243 |
UNCACHEABLE_PREPARE
|
|
244 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
245 |
uint8_t uncacheable; |
1
by brian
clean slate |
246 |
enum sub_select_type linkage; |
247 |
bool no_table_names_allowed; /* used for global order by */ |
|
248 |
bool no_error; /* suppress error message (convert it to warnings) */ |
|
249 |
||
250 |
static void *operator new(size_t size) |
|
251 |
{
|
|
252 |
return sql_alloc(size); |
|
253 |
}
|
|
254 |
static void *operator new(size_t size, MEM_ROOT *mem_root) |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
255 |
{ return (void*) alloc_root(mem_root, (uint32_t) size); } |
644
by Brian Aker
Clean up warnings for Solaris. |
256 |
static void operator delete(void *, size_t) |
77.1.7
by Monty Taylor
Heap builds clean. |
257 |
{ TRASH(ptr, size); } |
644
by Brian Aker
Clean up warnings for Solaris. |
258 |
static void operator delete(void *, MEM_ROOT *) |
77.1.7
by Monty Taylor
Heap builds clean. |
259 |
{}
|
847
by Brian Aker
More typdef class removal. |
260 |
Select_Lex_Node(): linkage(UNSPECIFIED_TYPE) {} |
261 |
virtual ~Select_Lex_Node() {} |
|
262 |
inline Select_Lex_Node* get_master() { return master; } |
|
1
by brian
clean slate |
263 |
virtual void init_query(); |
264 |
virtual void init_select(); |
|
847
by Brian Aker
More typdef class removal. |
265 |
void include_down(Select_Lex_Node *upper); |
266 |
void include_neighbour(Select_Lex_Node *before); |
|
267 |
void include_standalone(Select_Lex_Node *sel, Select_Lex_Node **ref); |
|
268 |
void include_global(Select_Lex_Node **plink); |
|
1
by brian
clean slate |
269 |
void exclude(); |
270 |
||
848
by Brian Aker
typdef class removal (just... use the name of the class). |
271 |
virtual Select_Lex_Unit* master_unit()= 0; |
846
by Brian Aker
Removing on typedeffed class. |
272 |
virtual Select_Lex* outer_select()= 0; |
273 |
virtual Select_Lex* return_after_parsing()= 0; |
|
1
by brian
clean slate |
274 |
|
275 |
virtual bool set_braces(bool value); |
|
276 |
virtual bool inc_in_sum_expr(); |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
277 |
virtual uint32_t get_in_sum_expr(); |
327.2.4
by Brian Aker
Refactoring table.h |
278 |
virtual TableList* get_table_list(); |
1
by brian
clean slate |
279 |
virtual List<Item>* get_item_list(); |
202
by Brian Aker
Cleanup sql_lex to modern types. |
280 |
virtual uint32_t get_table_join_options(); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
281 |
virtual TableList *add_table_to_list(Session *session, Table_ident *table, |
77.1.7
by Monty Taylor
Heap builds clean. |
282 |
LEX_STRING *alias, |
202
by Brian Aker
Cleanup sql_lex to modern types. |
283 |
uint32_t table_options, |
77.1.7
by Monty Taylor
Heap builds clean. |
284 |
thr_lock_type flags= TL_UNLOCK, |
285 |
List<Index_hint> *hints= 0, |
|
1
by brian
clean slate |
286 |
LEX_STRING *option= 0); |
644
by Brian Aker
Clean up warnings for Solaris. |
287 |
virtual void set_lock_for_tables(thr_lock_type) |
77.1.7
by Monty Taylor
Heap builds clean. |
288 |
{}
|
1
by brian
clean slate |
289 |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
290 |
friend class Select_Lex_Unit; |
575.4.7
by Monty Taylor
More header cleanup. |
291 |
friend bool mysql_new_select(LEX *lex, bool move_down); |
1
by brian
clean slate |
292 |
private: |
293 |
void fast_exclude(); |
|
294 |
};
|
|
295 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
296 |
/*
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
297 |
Select_Lex_Unit - unit of selects (UNION, INTERSECT, ...) group
|
846
by Brian Aker
Removing on typedeffed class. |
298 |
Select_Lexs
|
1
by brian
clean slate |
299 |
*/
|
520.1.21
by Brian Aker
THD -> Session rename |
300 |
class Session; |
1
by brian
clean slate |
301 |
class select_result; |
302 |
class JOIN; |
|
303 |
class select_union; |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
304 |
class Select_Lex_Unit: public Select_Lex_Node { |
1
by brian
clean slate |
305 |
protected: |
327.2.4
by Brian Aker
Refactoring table.h |
306 |
TableList result_table_list; |
1
by brian
clean slate |
307 |
select_union *union_result; |
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
308 |
Table *table; /* temporary table using for appending UNION results */ |
1
by brian
clean slate |
309 |
|
310 |
select_result *result; |
|
151
by Brian Aker
Ulonglong to uint64_t |
311 |
uint64_t found_rows_for_union; |
1
by brian
clean slate |
312 |
bool saved_error; |
313 |
||
314 |
public: |
|
315 |
bool prepared, // prepare phase already performed for UNION (unit) |
|
316 |
optimized, // optimize phase already performed for UNION (unit) |
|
317 |
executed, // already executed |
|
318 |
cleaned; |
|
319 |
||
320 |
// list of fields which points to temporary table for union
|
|
321 |
List<Item> item_list; |
|
322 |
/*
|
|
323 |
list of types of items inside union (used for union & derived tables)
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
324 |
|
1
by brian
clean slate |
325 |
Item_type_holders from which this list consist may have pointers to Field,
|
326 |
pointers is valid only after preparing SELECTS of this unit and before
|
|
327 |
any SELECT of this unit execution
|
|
328 |
||
329 |
TODO:
|
|
330 |
Possibly this member should be protected, and its direct use replaced
|
|
331 |
by get_unit_column_types(). Check the places where it is used.
|
|
332 |
*/
|
|
333 |
List<Item> types; |
|
334 |
/*
|
|
335 |
Pointer to 'last' select or pointer to unit where stored
|
|
336 |
global parameters for union
|
|
337 |
*/
|
|
846
by Brian Aker
Removing on typedeffed class. |
338 |
Select_Lex *global_parameters; |
1
by brian
clean slate |
339 |
//node on wich we should return current_select pointer after parsing subquery
|
846
by Brian Aker
Removing on typedeffed class. |
340 |
Select_Lex *return_to; |
1
by brian
clean slate |
341 |
/* LIMIT clause runtime counters */
|
342 |
ha_rows select_limit_cnt, offset_limit_cnt; |
|
343 |
/* not NULL if unit used in subselect, point to subselect item */
|
|
344 |
Item_subselect *item; |
|
345 |
/* thread handler */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
346 |
Session *session; |
1
by brian
clean slate |
347 |
/*
|
846
by Brian Aker
Removing on typedeffed class. |
348 |
Select_Lex for hidden SELECT in onion which process global
|
1
by brian
clean slate |
349 |
ORDER BY and LIMIT
|
350 |
*/
|
|
846
by Brian Aker
Removing on typedeffed class. |
351 |
Select_Lex *fake_select_lex; |
1
by brian
clean slate |
352 |
|
846
by Brian Aker
Removing on typedeffed class. |
353 |
Select_Lex *union_distinct; /* pointer to the last UNION DISTINCT */ |
1
by brian
clean slate |
354 |
bool describe; /* union exec() called for EXPLAIN */ |
355 |
||
356 |
void init_query(); |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
357 |
Select_Lex_Unit* master_unit(); |
846
by Brian Aker
Removing on typedeffed class. |
358 |
Select_Lex* outer_select(); |
359 |
Select_Lex* first_select() |
|
360 |
{
|
|
361 |
return reinterpret_cast<Select_Lex*>(slave); |
|
362 |
}
|
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
363 |
Select_Lex_Unit* next_unit() |
846
by Brian Aker
Removing on typedeffed class. |
364 |
{
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
365 |
return reinterpret_cast<Select_Lex_Unit*>(next); |
846
by Brian Aker
Removing on typedeffed class. |
366 |
}
|
367 |
Select_Lex* return_after_parsing() { return return_to; } |
|
1
by brian
clean slate |
368 |
void exclude_level(); |
369 |
void exclude_tree(); |
|
370 |
||
371 |
/* UNION methods */
|
|
892.2.4
by Monty Taylor
Fixed more warnings. |
372 |
bool prepare(Session *session, select_result *result, |
373 |
uint64_t additional_options); |
|
1
by brian
clean slate |
374 |
bool exec(); |
375 |
bool cleanup(); |
|
376 |
inline void unclean() { cleaned= 0; } |
|
377 |
void reinit_exec_mechanism(); |
|
378 |
||
379 |
void print(String *str, enum_query_type query_type); |
|
380 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
381 |
bool add_fake_select_lex(Session *session); |
382 |
void init_prepare_fake_select_lex(Session *session); |
|
1
by brian
clean slate |
383 |
bool change_result(select_result_interceptor *result, |
384 |
select_result_interceptor *old_result); |
|
846
by Brian Aker
Removing on typedeffed class. |
385 |
void set_limit(Select_Lex *values); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
386 |
void set_session(Session *session_arg) { session= session_arg; } |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
387 |
inline bool is_union (); |
1
by brian
clean slate |
388 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
389 |
friend void lex_start(Session *session); |
1
by brian
clean slate |
390 |
friend int subselect_union_engine::exec(); |
391 |
||
392 |
List<Item> *get_unit_column_types(); |
|
393 |
};
|
|
394 |
||
395 |
/*
|
|
846
by Brian Aker
Removing on typedeffed class. |
396 |
Select_Lex - store information of parsed SELECT statment
|
1
by brian
clean slate |
397 |
*/
|
847
by Brian Aker
More typdef class removal. |
398 |
class Select_Lex: public Select_Lex_Node |
1
by brian
clean slate |
399 |
{
|
400 |
public: |
|
401 |
Name_resolution_context context; |
|
402 |
char *db; |
|
403 |
Item *where, *having; /* WHERE & HAVING clauses */ |
|
404 |
/* Saved values of the WHERE and HAVING clauses*/
|
|
405 |
Item::cond_result cond_value, having_value; |
|
406 |
/* point on lex in which it was created, used in view subquery detection */
|
|
575.4.7
by Monty Taylor
More header cleanup. |
407 |
LEX *parent_lex; |
1
by brian
clean slate |
408 |
enum olap_type olap; |
327.2.4
by Brian Aker
Refactoring table.h |
409 |
/* FROM clause - points to the beginning of the TableList::next_local list. */
|
1
by brian
clean slate |
410 |
SQL_LIST table_list; |
411 |
SQL_LIST group_list; /* GROUP BY clause. */ |
|
412 |
List<Item> item_list; /* list of fields & expressions */ |
|
413 |
List<String> interval_list; |
|
414 |
bool is_item_list_lookup; |
|
415 |
JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */ |
|
327.2.4
by Brian Aker
Refactoring table.h |
416 |
List<TableList> top_join_list; /* join list of the top level */ |
417 |
List<TableList> *join_list; /* list for the currently parsed join */ |
|
418 |
TableList *embedding; /* table embedding to the above list */ |
|
419 |
List<TableList> sj_nests; |
|
1
by brian
clean slate |
420 |
/*
|
421 |
Beginning of the list of leaves in a FROM clause, where the leaves
|
|
422 |
inlcude all base tables including view tables. The tables are connected
|
|
327.2.4
by Brian Aker
Refactoring table.h |
423 |
by TableList::next_leaf, so leaf_tables points to the left-most leaf.
|
1
by brian
clean slate |
424 |
*/
|
327.2.4
by Brian Aker
Refactoring table.h |
425 |
TableList *leaf_tables; |
1
by brian
clean slate |
426 |
const char *type; /* type of select for EXPLAIN */ |
427 |
||
428 |
SQL_LIST order_list; /* ORDER clause */ |
|
429 |
SQL_LIST *gorder_list; |
|
430 |
Item *select_limit, *offset_limit; /* LIMIT clause parameters */ |
|
431 |
// Arrays of pointers to top elements of all_fields list
|
|
432 |
Item **ref_pointer_array; |
|
433 |
||
434 |
/*
|
|
435 |
number of items in select_list and HAVING clause used to get number
|
|
436 |
bigger then can be number of entries that will be added to all item
|
|
437 |
list during split_sum_func
|
|
438 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
439 |
uint32_t select_n_having_items; |
440 |
uint32_t cond_count; /* number of arguments of and/or/xor in where/having/on */ |
|
441 |
uint32_t between_count; /* number of between predicates in where/having/on */ |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
442 |
uint32_t max_equal_elems; /* maximal number of elements in multiple equalities */ |
1
by brian
clean slate |
443 |
/*
|
444 |
Number of fields used in select list or where clause of current select
|
|
445 |
and all inner subselects.
|
|
446 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
447 |
uint32_t select_n_where_fields; |
1
by brian
clean slate |
448 |
enum_parsing_place parsing_place; /* where we are parsing expression */ |
449 |
bool with_sum_func; /* sum function indicator */ |
|
450 |
||
202
by Brian Aker
Cleanup sql_lex to modern types. |
451 |
uint32_t table_join_options; |
452 |
uint32_t in_sum_expr; |
|
453 |
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. |
454 |
int8_t nest_level; /* nesting level of select */ |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
455 |
Item_sum *inner_sum_func_list; /* list of sum func in nested selects */ |
202
by Brian Aker
Cleanup sql_lex to modern types. |
456 |
uint32_t with_wild; /* item list contain '*' */ |
1
by brian
clean slate |
457 |
bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ |
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
458 |
/* true when having fix field called in processing of this SELECT */
|
1
by brian
clean slate |
459 |
bool having_fix_field; |
460 |
/* List of references to fields referenced from inner selects */
|
|
461 |
List<Item_outer_ref> inner_refs_list; |
|
462 |
/* Number of Item_sum-derived objects in this SELECT */
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
463 |
uint32_t n_sum_items; |
1
by brian
clean slate |
464 |
/* Number of Item_sum-derived objects in children and descendant SELECTs */
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
465 |
uint32_t n_child_sum_items; |
1
by brian
clean slate |
466 |
|
467 |
/* explicit LIMIT clause was used */
|
|
468 |
bool explicit_limit; |
|
469 |
/*
|
|
470 |
there are subquery in HAVING clause => we can't close tables before
|
|
471 |
query processing end even if we use temporary table
|
|
472 |
*/
|
|
473 |
bool subquery_in_having; |
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
474 |
/* true <=> this SELECT is correlated w.r.t. some ancestor select */
|
1
by brian
clean slate |
475 |
bool is_correlated; |
476 |
/* exclude this select from check of unique_table() */
|
|
477 |
bool exclude_from_table_unique_test; |
|
478 |
/* List of fields that aren't under an aggregate function */
|
|
479 |
List<Item_field> non_agg_fields; |
|
480 |
/* index in the select list of the expression currently being fixed */
|
|
481 |
int cur_pos_in_select_list; |
|
482 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
483 |
/*
|
1
by brian
clean slate |
484 |
This is a copy of the original JOIN USING list that comes from
|
485 |
the parser. The parser :
|
|
327.2.4
by Brian Aker
Refactoring table.h |
486 |
1. Sets the natural_join of the second TableList in the join
|
846
by Brian Aker
Removing on typedeffed class. |
487 |
and the Select_Lex::prev_join_using.
|
327.2.4
by Brian Aker
Refactoring table.h |
488 |
2. Makes a parent TableList and sets its is_natural_join/
|
1
by brian
clean slate |
489 |
join_using_fields members.
|
327.2.4
by Brian Aker
Refactoring table.h |
490 |
3. Uses the wrapper TableList as a table in the upper level.
|
1
by brian
clean slate |
491 |
We cannot assign directly to join_using_fields in the parser because
|
327.2.4
by Brian Aker
Refactoring table.h |
492 |
at stage (1.) the parent TableList is not constructed yet and
|
1
by brian
clean slate |
493 |
the assignment will override the JOIN USING fields of the lower level
|
494 |
joins on the right.
|
|
495 |
*/
|
|
496 |
List<String> *prev_join_using; |
|
497 |
/*
|
|
498 |
Bitmap used in the ONLY_FULL_GROUP_BY_MODE to prevent mixture of aggregate
|
|
499 |
functions and non aggregated fields when GROUP BY list is absent.
|
|
500 |
Bits:
|
|
501 |
0 - non aggregated fields are used in this select,
|
|
502 |
defined as NON_AGG_FIELD_USED.
|
|
503 |
1 - aggregate functions are used in this select,
|
|
504 |
defined as SUM_FUNC_USED.
|
|
505 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
506 |
uint8_t full_group_by_flag; |
1
by brian
clean slate |
507 |
void init_query(); |
508 |
void init_select(); |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
509 |
Select_Lex_Unit* master_unit(); |
510 |
Select_Lex_Unit* first_inner_unit() |
|
846
by Brian Aker
Removing on typedeffed class. |
511 |
{
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
512 |
return (Select_Lex_Unit*) slave; |
846
by Brian Aker
Removing on typedeffed class. |
513 |
}
|
514 |
Select_Lex* outer_select(); |
|
515 |
Select_Lex* next_select() { return (Select_Lex*) next; } |
|
516 |
Select_Lex* next_select_in_list() |
|
517 |
{
|
|
518 |
return (Select_Lex*) link_next; |
|
519 |
}
|
|
847
by Brian Aker
More typdef class removal. |
520 |
Select_Lex_Node** next_select_in_list_addr() |
1
by brian
clean slate |
521 |
{
|
522 |
return &link_next; |
|
523 |
}
|
|
846
by Brian Aker
Removing on typedeffed class. |
524 |
Select_Lex* return_after_parsing() |
1
by brian
clean slate |
525 |
{
|
526 |
return master_unit()->return_after_parsing(); |
|
527 |
}
|
|
528 |
||
846
by Brian Aker
Removing on typedeffed class. |
529 |
void mark_as_dependent(Select_Lex *last); |
1
by brian
clean slate |
530 |
|
531 |
bool set_braces(bool value); |
|
532 |
bool inc_in_sum_expr(); |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
533 |
uint32_t get_in_sum_expr(); |
1
by brian
clean slate |
534 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
535 |
bool add_item_to_list(Session *session, Item *item); |
536 |
bool add_group_to_list(Session *session, Item *item, bool asc); |
|
537 |
bool add_order_to_list(Session *session, Item *item, bool asc); |
|
538 |
TableList* add_table_to_list(Session *session, Table_ident *table, |
|
1
by brian
clean slate |
539 |
LEX_STRING *alias, |
202
by Brian Aker
Cleanup sql_lex to modern types. |
540 |
uint32_t table_options, |
1
by brian
clean slate |
541 |
thr_lock_type flags= TL_UNLOCK, |
542 |
List<Index_hint> *hints= 0, |
|
543 |
LEX_STRING *option= 0); |
|
327.2.4
by Brian Aker
Refactoring table.h |
544 |
TableList* get_table_list(); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
545 |
bool init_nested_join(Session *session); |
546 |
TableList *end_nested_join(Session *session); |
|
547 |
TableList *nest_last_join(Session *session); |
|
327.2.4
by Brian Aker
Refactoring table.h |
548 |
void add_joined_table(TableList *table); |
549 |
TableList *convert_right_join(); |
|
1
by brian
clean slate |
550 |
List<Item>* get_item_list(); |
202
by Brian Aker
Cleanup sql_lex to modern types. |
551 |
uint32_t get_table_join_options(); |
1
by brian
clean slate |
552 |
void set_lock_for_tables(thr_lock_type lock_type); |
553 |
inline void init_order() |
|
554 |
{
|
|
555 |
order_list.elements= 0; |
|
556 |
order_list.first= 0; |
|
481
by Brian Aker
Remove all of uchar. |
557 |
order_list.next= (unsigned char**) &order_list.first; |
1
by brian
clean slate |
558 |
}
|
559 |
/*
|
|
560 |
This method created for reiniting LEX in mysql_admin_table() and can be
|
|
846
by Brian Aker
Removing on typedeffed class. |
561 |
used only if you are going remove all Select_Lex & units except belonger
|
1
by brian
clean slate |
562 |
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). |
563 |
Select_Lex_Unit::exclude_level & Select_Lex_Unit::exclude_tree
|
1
by brian
clean slate |
564 |
*/
|
565 |
void cut_subtree() { slave= 0; } |
|
566 |
bool test_limit(); |
|
567 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
568 |
friend void lex_start(Session *session); |
846
by Brian Aker
Removing on typedeffed class. |
569 |
Select_Lex() : n_sum_items(0), n_child_sum_items(0) {} |
1
by brian
clean slate |
570 |
void make_empty_select() |
571 |
{
|
|
572 |
init_query(); |
|
573 |
init_select(); |
|
574 |
}
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
575 |
bool setup_ref_array(Session *session, uint32_t order_group_num); |
576 |
void print(Session *session, String *str, enum_query_type query_type); |
|
1
by brian
clean slate |
577 |
static void print_order(String *str, |
327.2.3
by Brian Aker
Refactoring of class Table |
578 |
order_st *order, |
1
by brian
clean slate |
579 |
enum_query_type query_type); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
580 |
void print_limit(Session *session, String *str, enum_query_type query_type); |
581 |
void fix_prepare_information(Session *session, Item **conds, Item **having_conds); |
|
1
by brian
clean slate |
582 |
/*
|
583 |
Destroy the used execution plan (JOIN) of this subtree (this
|
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
584 |
Select_Lex and all nested Select_Lexes and Select_Lex_Units).
|
1
by brian
clean slate |
585 |
*/
|
586 |
bool cleanup(); |
|
587 |
/*
|
|
588 |
Recursively cleanup the join of this select lex and of all nested
|
|
589 |
select lexes.
|
|
590 |
*/
|
|
591 |
void cleanup_all_joins(bool full); |
|
592 |
||
593 |
void set_index_hint_type(enum index_hint_type type, index_clause_map clause); |
|
594 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
595 |
/*
|
1
by brian
clean slate |
596 |
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: |
597 |
hint will be the current ones (set by set_index_hint())
|
1
by brian
clean slate |
598 |
*/
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
599 |
bool add_index_hint (Session *session, char *str, uint32_t length); |
1
by brian
clean slate |
600 |
|
601 |
/* make a list to hold index hints */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
602 |
void alloc_index_hints (Session *session); |
1
by brian
clean slate |
603 |
/* read and clear the index hints */
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
604 |
List<Index_hint>* pop_index_hints(void) |
1
by brian
clean slate |
605 |
{
|
606 |
List<Index_hint> *hints= index_hints; |
|
607 |
index_hints= NULL; |
|
608 |
return hints; |
|
609 |
}
|
|
610 |
||
611 |
void clear_index_hints(void) { index_hints= NULL; } |
|
612 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
613 |
private: |
1
by brian
clean slate |
614 |
/* current index hint kind. used in filling up index_hints */
|
615 |
enum index_hint_type current_index_hint_type; |
|
616 |
index_clause_map current_index_hint_clause; |
|
617 |
/* a list of USE/FORCE/IGNORE INDEX */
|
|
618 |
List<Index_hint> *index_hints; |
|
619 |
};
|
|
620 |
||
848
by Brian Aker
typdef class removal (just... use the name of the class). |
621 |
inline bool Select_Lex_Unit::is_union () |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
622 |
{
|
623 |
return first_select()->next_select() && |
|
1
by brian
clean slate |
624 |
first_select()->next_select()->linkage == UNION_TYPE; |
625 |
}
|
|
626 |
||
627 |
#define ALTER_ADD_COLUMN (1L << 0)
|
|
628 |
#define ALTER_DROP_COLUMN (1L << 1)
|
|
629 |
#define ALTER_CHANGE_COLUMN (1L << 2)
|
|
630 |
#define ALTER_COLUMN_STORAGE (1L << 3)
|
|
631 |
#define ALTER_COLUMN_FORMAT (1L << 4)
|
|
632 |
#define ALTER_COLUMN_ORDER (1L << 5)
|
|
633 |
#define ALTER_ADD_INDEX (1L << 6)
|
|
634 |
#define ALTER_DROP_INDEX (1L << 7)
|
|
635 |
#define ALTER_RENAME (1L << 8)
|
|
636 |
#define ALTER_ORDER (1L << 9)
|
|
637 |
#define ALTER_OPTIONS (1L << 10)
|
|
638 |
#define ALTER_COLUMN_DEFAULT (1L << 11)
|
|
639 |
#define ALTER_KEYS_ONOFF (1L << 12)
|
|
640 |
#define ALTER_STORAGE (1L << 13)
|
|
641 |
#define ALTER_ROW_FORMAT (1L << 14)
|
|
642 |
#define ALTER_CONVERT (1L << 15)
|
|
643 |
#define ALTER_FORCE (1L << 16)
|
|
644 |
#define ALTER_RECREATE (1L << 17)
|
|
645 |
#define ALTER_TABLE_REORG (1L << 24)
|
|
646 |
#define ALTER_FOREIGN_KEY (1L << 31)
|
|
647 |
||
648 |
/**
|
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
649 |
@brief Parsing data for CREATE or ALTER Table.
|
1
by brian
clean slate |
650 |
|
651 |
This structure contains a list of columns or indexes to be created,
|
|
652 |
altered or dropped.
|
|
653 |
*/
|
|
654 |
||
655 |
class Alter_info |
|
656 |
{
|
|
657 |
public: |
|
658 |
List<Alter_drop> drop_list; |
|
659 |
List<Alter_column> alter_list; |
|
660 |
List<Key> key_list; |
|
661 |
List<Create_field> create_list; |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
662 |
uint32_t flags; |
1
by brian
clean slate |
663 |
enum enum_enable_or_disable keys_onoff; |
664 |
enum tablespace_op_type tablespace_op; |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
665 |
uint32_t no_parts; |
1
by brian
clean slate |
666 |
enum ha_build_method build_method; |
667 |
Create_field *datetime_field; |
|
668 |
bool error_if_not_empty; |
|
669 |
||
670 |
||
671 |
Alter_info() : |
|
672 |
flags(0), |
|
673 |
keys_onoff(LEAVE_AS_IS), |
|
674 |
tablespace_op(NO_TABLESPACE_OP), |
|
675 |
no_parts(0), |
|
676 |
build_method(HA_BUILD_DEFAULT), |
|
677 |
datetime_field(NULL), |
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
678 |
error_if_not_empty(false) |
1
by brian
clean slate |
679 |
{}
|
680 |
||
681 |
void reset() |
|
682 |
{
|
|
683 |
drop_list.empty(); |
|
684 |
alter_list.empty(); |
|
685 |
key_list.empty(); |
|
686 |
create_list.empty(); |
|
687 |
flags= 0; |
|
688 |
keys_onoff= LEAVE_AS_IS; |
|
689 |
tablespace_op= NO_TABLESPACE_OP; |
|
690 |
no_parts= 0; |
|
691 |
build_method= HA_BUILD_DEFAULT; |
|
692 |
datetime_field= 0; |
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
693 |
error_if_not_empty= false; |
1
by brian
clean slate |
694 |
}
|
695 |
Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root); |
|
696 |
private: |
|
697 |
Alter_info &operator=(const Alter_info &rhs); // not implemented |
|
698 |
Alter_info(const Alter_info &rhs); // not implemented |
|
699 |
};
|
|
700 |
||
701 |
enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, |
|
702 |
XA_SUSPEND, XA_FOR_MIGRATE}; |
|
703 |
||
704 |
extern const LEX_STRING null_lex_str; |
|
705 |
||
706 |
||
707 |
/*
|
|
708 |
Class representing list of all tables used by statement.
|
|
709 |
It also contains information about stored functions used by statement
|
|
710 |
since during its execution we may have to add all tables used by its
|
|
711 |
stored functions/triggers to this list in order to pre-open and lock
|
|
712 |
them.
|
|
713 |
||
714 |
Also used by st_lex::reset_n_backup/restore_backup_query_tables_list()
|
|
715 |
methods to save and restore this information.
|
|
716 |
*/
|
|
717 |
||
718 |
class Query_tables_list |
|
719 |
{
|
|
720 |
public: |
|
721 |
/* Global list of all tables used by this statement */
|
|
327.2.4
by Brian Aker
Refactoring table.h |
722 |
TableList *query_tables; |
1
by brian
clean slate |
723 |
/* Pointer to next_global member of last element in the previous list. */
|
327.2.4
by Brian Aker
Refactoring table.h |
724 |
TableList **query_tables_last; |
1
by brian
clean slate |
725 |
/*
|
726 |
If non-0 then indicates that query requires prelocking and points to
|
|
727 |
next_global member of last own element in query table list (i.e. last
|
|
728 |
table which was not added to it as part of preparation to prelocking).
|
|
729 |
0 - indicates that this query does not need prelocking.
|
|
730 |
*/
|
|
327.2.4
by Brian Aker
Refactoring table.h |
731 |
TableList **query_tables_own_last; |
1
by brian
clean slate |
732 |
|
733 |
/*
|
|
734 |
These constructor and destructor serve for creation/destruction
|
|
735 |
of Query_tables_list instances which are used as backup storage.
|
|
736 |
*/
|
|
737 |
Query_tables_list() {} |
|
738 |
~Query_tables_list() {} |
|
739 |
||
740 |
/* Initializes (or resets) Query_tables_list object for "real" use. */
|
|
741 |
void reset_query_tables_list(bool init); |
|
742 |
void set_query_tables_list(Query_tables_list *state) |
|
743 |
{
|
|
744 |
*this= *state; |
|
745 |
}
|
|
746 |
||
747 |
/*
|
|
748 |
Direct addition to the list of query tables.
|
|
749 |
If you are using this function, you must ensure that the table
|
|
750 |
object, in particular table->db member, is initialized.
|
|
751 |
*/
|
|
327.2.4
by Brian Aker
Refactoring table.h |
752 |
void add_to_query_tables(TableList *table) |
1
by brian
clean slate |
753 |
{
|
754 |
*(table->prev_global= query_tables_last)= table; |
|
755 |
query_tables_last= &table->next_global; |
|
756 |
}
|
|
757 |
/* Return pointer to first not-own table in query-tables or 0 */
|
|
327.2.4
by Brian Aker
Refactoring table.h |
758 |
TableList* first_not_own_table() |
1
by brian
clean slate |
759 |
{
|
760 |
return ( query_tables_own_last ? *query_tables_own_last : 0); |
|
761 |
}
|
|
762 |
void chop_off_not_own_tables() |
|
763 |
{
|
|
764 |
if (query_tables_own_last) |
|
765 |
{
|
|
766 |
*query_tables_own_last= 0; |
|
767 |
query_tables_last= query_tables_own_last; |
|
768 |
query_tables_own_last= 0; |
|
769 |
}
|
|
770 |
}
|
|
771 |
};
|
|
772 |
||
773 |
||
774 |
/*
|
|
775 |
st_parsing_options contains the flags for constructions that are
|
|
776 |
allowed in the current statement.
|
|
777 |
*/
|
|
778 |
||
779 |
struct st_parsing_options |
|
780 |
{
|
|
781 |
bool allows_select_procedure; |
|
782 |
||
783 |
st_parsing_options() { reset(); } |
|
784 |
void reset(); |
|
785 |
};
|
|
786 |
||
787 |
||
788 |
/**
|
|
789 |
The state of the lexical parser, when parsing comments.
|
|
790 |
*/
|
|
791 |
enum enum_comment_state |
|
792 |
{
|
|
793 |
/**
|
|
794 |
Not parsing comments.
|
|
795 |
*/
|
|
796 |
NO_COMMENT, |
|
797 |
/**
|
|
798 |
Parsing comments that need to be preserved.
|
|
799 |
Typically, these are user comments '/' '*' ... '*' '/'.
|
|
800 |
*/
|
|
801 |
PRESERVE_COMMENT, |
|
802 |
/**
|
|
803 |
Parsing comments that need to be discarded.
|
|
804 |
Typically, these are special comments '/' '*' '!' ... '*' '/',
|
|
805 |
or '/' '*' '!' 'M' 'M' 'm' 'm' 'm' ... '*' '/', where the comment
|
|
806 |
markers should not be expanded.
|
|
807 |
*/
|
|
808 |
DISCARD_COMMENT
|
|
809 |
};
|
|
810 |
||
811 |
||
812 |
/**
|
|
813 |
@brief This class represents the character input stream consumed during
|
|
814 |
lexical analysis.
|
|
815 |
||
816 |
In addition to consuming the input stream, this class performs some
|
|
817 |
comment pre processing, by filtering out out of bound special text
|
|
818 |
from the query input stream.
|
|
819 |
Two buffers, with pointers inside each buffers, are maintained in
|
|
820 |
parallel. The 'raw' buffer is the original query text, which may
|
|
821 |
contain out-of-bound comments. The 'cpp' (for comments pre processor)
|
|
822 |
is the pre-processed buffer that contains only the query text that
|
|
823 |
should be seen once out-of-bound data is removed.
|
|
824 |
*/
|
|
825 |
||
826 |
class Lex_input_stream |
|
827 |
{
|
|
828 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
829 |
Lex_input_stream(Session *session, const char* buff, unsigned int length); |
1
by brian
clean slate |
830 |
~Lex_input_stream(); |
831 |
||
832 |
/**
|
|
833 |
Set the echo mode.
|
|
834 |
||
835 |
When echo is true, characters parsed from the raw input stream are
|
|
836 |
preserved. When false, characters parsed are silently ignored.
|
|
837 |
@param echo the echo mode.
|
|
838 |
*/
|
|
839 |
void set_echo(bool echo) |
|
840 |
{
|
|
841 |
m_echo= echo; |
|
842 |
}
|
|
843 |
||
844 |
/**
|
|
845 |
Skip binary from the input stream.
|
|
846 |
@param n number of bytes to accept.
|
|
847 |
*/
|
|
848 |
void skip_binary(int n) |
|
849 |
{
|
|
850 |
if (m_echo) |
|
851 |
{
|
|
852 |
memcpy(m_cpp_ptr, m_ptr, n); |
|
853 |
m_cpp_ptr += n; |
|
854 |
}
|
|
855 |
m_ptr += n; |
|
856 |
}
|
|
857 |
||
858 |
/**
|
|
859 |
Get a character, and advance in the stream.
|
|
860 |
@return the next character to parse.
|
|
861 |
*/
|
|
862 |
char yyGet() |
|
863 |
{
|
|
864 |
char c= *m_ptr++; |
|
865 |
if (m_echo) |
|
866 |
*m_cpp_ptr++ = c; |
|
867 |
return c; |
|
868 |
}
|
|
869 |
||
870 |
/**
|
|
871 |
Get the last character accepted.
|
|
872 |
@return the last character accepted.
|
|
873 |
*/
|
|
874 |
char yyGetLast() |
|
875 |
{
|
|
876 |
return m_ptr[-1]; |
|
877 |
}
|
|
878 |
||
879 |
/**
|
|
880 |
Look at the next character to parse, but do not accept it.
|
|
881 |
*/
|
|
882 |
char yyPeek() |
|
883 |
{
|
|
884 |
return m_ptr[0]; |
|
885 |
}
|
|
886 |
||
887 |
/**
|
|
888 |
Look ahead at some character to parse.
|
|
889 |
@param n offset of the character to look up
|
|
890 |
*/
|
|
891 |
char yyPeekn(int n) |
|
892 |
{
|
|
893 |
return m_ptr[n]; |
|
894 |
}
|
|
895 |
||
896 |
/**
|
|
897 |
Cancel the effect of the last yyGet() or yySkip().
|
|
898 |
Note that the echo mode should not change between calls to yyGet / yySkip
|
|
899 |
and yyUnget. The caller is responsible for ensuring that.
|
|
900 |
*/
|
|
901 |
void yyUnget() |
|
902 |
{
|
|
903 |
m_ptr--; |
|
904 |
if (m_echo) |
|
905 |
m_cpp_ptr--; |
|
906 |
}
|
|
907 |
||
908 |
/**
|
|
909 |
Accept a character, by advancing the input stream.
|
|
910 |
*/
|
|
911 |
void yySkip() |
|
912 |
{
|
|
913 |
if (m_echo) |
|
914 |
*m_cpp_ptr++ = *m_ptr++; |
|
915 |
else
|
|
916 |
m_ptr++; |
|
917 |
}
|
|
918 |
||
919 |
/**
|
|
920 |
Accept multiple characters at once.
|
|
921 |
@param n the number of characters to accept.
|
|
922 |
*/
|
|
923 |
void yySkipn(int n) |
|
924 |
{
|
|
925 |
if (m_echo) |
|
926 |
{
|
|
927 |
memcpy(m_cpp_ptr, m_ptr, n); |
|
928 |
m_cpp_ptr += n; |
|
929 |
}
|
|
930 |
m_ptr += n; |
|
931 |
}
|
|
932 |
||
933 |
/**
|
|
934 |
End of file indicator for the query text to parse.
|
|
935 |
@return true if there are no more characters to parse
|
|
936 |
*/
|
|
937 |
bool eof() |
|
938 |
{
|
|
939 |
return (m_ptr >= m_end_of_query); |
|
940 |
}
|
|
941 |
||
942 |
/**
|
|
943 |
End of file indicator for the query text to parse.
|
|
944 |
@param n number of characters expected
|
|
945 |
@return true if there are less than n characters to parse
|
|
946 |
*/
|
|
947 |
bool eof(int n) |
|
948 |
{
|
|
949 |
return ((m_ptr + n) >= m_end_of_query); |
|
950 |
}
|
|
951 |
||
952 |
/** Get the raw query buffer. */
|
|
953 |
const char *get_buf() |
|
954 |
{
|
|
955 |
return m_buf; |
|
956 |
}
|
|
957 |
||
958 |
/** Get the pre-processed query buffer. */
|
|
959 |
const char *get_cpp_buf() |
|
960 |
{
|
|
961 |
return m_cpp_buf; |
|
962 |
}
|
|
963 |
||
964 |
/** Get the end of the raw query buffer. */
|
|
965 |
const char *get_end_of_query() |
|
966 |
{
|
|
967 |
return m_end_of_query; |
|
968 |
}
|
|
969 |
||
970 |
/** Mark the stream position as the start of a new token. */
|
|
971 |
void start_token() |
|
972 |
{
|
|
973 |
m_tok_start_prev= m_tok_start; |
|
974 |
m_tok_start= m_ptr; |
|
975 |
m_tok_end= m_ptr; |
|
976 |
||
977 |
m_cpp_tok_start_prev= m_cpp_tok_start; |
|
978 |
m_cpp_tok_start= m_cpp_ptr; |
|
979 |
m_cpp_tok_end= m_cpp_ptr; |
|
980 |
}
|
|
981 |
||
982 |
/**
|
|
983 |
Adjust the starting position of the current token.
|
|
984 |
This is used to compensate for starting whitespace.
|
|
985 |
*/
|
|
986 |
void restart_token() |
|
987 |
{
|
|
988 |
m_tok_start= m_ptr; |
|
989 |
m_cpp_tok_start= m_cpp_ptr; |
|
990 |
}
|
|
991 |
||
992 |
/** Get the token start position, in the raw buffer. */
|
|
993 |
const char *get_tok_start() |
|
994 |
{
|
|
995 |
return m_tok_start; |
|
996 |
}
|
|
997 |
||
998 |
/** Get the token start position, in the pre-processed buffer. */
|
|
999 |
const char *get_cpp_tok_start() |
|
1000 |
{
|
|
1001 |
return m_cpp_tok_start; |
|
1002 |
}
|
|
1003 |
||
1004 |
/** Get the token end position, in the raw buffer. */
|
|
1005 |
const char *get_tok_end() |
|
1006 |
{
|
|
1007 |
return m_tok_end; |
|
1008 |
}
|
|
1009 |
||
1010 |
/** Get the token end position, in the pre-processed buffer. */
|
|
1011 |
const char *get_cpp_tok_end() |
|
1012 |
{
|
|
1013 |
return m_cpp_tok_end; |
|
1014 |
}
|
|
1015 |
||
1016 |
/** Get the previous token start position, in the raw buffer. */
|
|
1017 |
const char *get_tok_start_prev() |
|
1018 |
{
|
|
1019 |
return m_tok_start_prev; |
|
1020 |
}
|
|
1021 |
||
1022 |
/** Get the current stream pointer, in the raw buffer. */
|
|
1023 |
const char *get_ptr() |
|
1024 |
{
|
|
1025 |
return m_ptr; |
|
1026 |
}
|
|
1027 |
||
1028 |
/** Get the current stream pointer, in the pre-processed buffer. */
|
|
1029 |
const char *get_cpp_ptr() |
|
1030 |
{
|
|
1031 |
return m_cpp_ptr; |
|
1032 |
}
|
|
1033 |
||
1034 |
/** Get the length of the current token, in the raw buffer. */
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
1035 |
uint32_t yyLength() |
1
by brian
clean slate |
1036 |
{
|
1037 |
/*
|
|
1038 |
The assumption is that the lexical analyser is always 1 character ahead,
|
|
1039 |
which the -1 account for.
|
|
1040 |
*/
|
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1041 |
assert(m_ptr > m_tok_start); |
202
by Brian Aker
Cleanup sql_lex to modern types. |
1042 |
return (uint32_t) ((m_ptr - m_tok_start) - 1); |
1
by brian
clean slate |
1043 |
}
|
1044 |
||
1045 |
/** Get the utf8-body string. */
|
|
1046 |
const char *get_body_utf8_str() |
|
1047 |
{
|
|
1048 |
return m_body_utf8; |
|
1049 |
}
|
|
1050 |
||
1051 |
/** Get the utf8-body length. */
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
1052 |
uint32_t get_body_utf8_length() |
1
by brian
clean slate |
1053 |
{
|
1054 |
return m_body_utf8_ptr - m_body_utf8; |
|
1055 |
}
|
|
1056 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1057 |
void body_utf8_start(Session *session, const char *begin_ptr); |
1
by brian
clean slate |
1058 |
void body_utf8_append(const char *ptr); |
1059 |
void body_utf8_append(const char *ptr, const char *end_ptr); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1060 |
void body_utf8_append_literal(Session *session, |
1
by brian
clean slate |
1061 |
const LEX_STRING *txt, |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1062 |
const CHARSET_INFO * const txt_cs, |
1
by brian
clean slate |
1063 |
const char *end_ptr); |
1064 |
||
1065 |
/** Current thread. */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1066 |
Session *m_session; |
1
by brian
clean slate |
1067 |
|
1068 |
/** Current line number. */
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
1069 |
uint32_t yylineno; |
1
by brian
clean slate |
1070 |
|
1071 |
/** Length of the last token parsed. */
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
1072 |
uint32_t yytoklen; |
1
by brian
clean slate |
1073 |
|
1074 |
/** Interface with bison, value of the last token parsed. */
|
|
1075 |
LEX_YYSTYPE yylval; |
|
1076 |
||
1077 |
/** LALR(2) resolution, look ahead token.*/
|
|
1078 |
int lookahead_token; |
|
1079 |
||
1080 |
/** LALR(2) resolution, value of the look ahead token.*/
|
|
1081 |
LEX_YYSTYPE lookahead_yylval; |
|
1082 |
||
1083 |
private: |
|
1084 |
/** Pointer to the current position in the raw input stream. */
|
|
1085 |
const char *m_ptr; |
|
1086 |
||
1087 |
/** Starting position of the last token parsed, in the raw buffer. */
|
|
1088 |
const char *m_tok_start; |
|
1089 |
||
1090 |
/** Ending position of the previous token parsed, in the raw buffer. */
|
|
1091 |
const char *m_tok_end; |
|
1092 |
||
1093 |
/** End of the query text in the input stream, in the raw buffer. */
|
|
1094 |
const char *m_end_of_query; |
|
1095 |
||
1096 |
/** Starting position of the previous token parsed, in the raw buffer. */
|
|
1097 |
const char *m_tok_start_prev; |
|
1098 |
||
1099 |
/** Begining of the query text in the input stream, in the raw buffer. */
|
|
1100 |
const char *m_buf; |
|
1101 |
||
1102 |
/** Length of the raw buffer. */
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
1103 |
uint32_t m_buf_length; |
1
by brian
clean slate |
1104 |
|
1105 |
/** Echo the parsed stream to the pre-processed buffer. */
|
|
1106 |
bool m_echo; |
|
1107 |
||
1108 |
/** Pre-processed buffer. */
|
|
1109 |
char *m_cpp_buf; |
|
1110 |
||
1111 |
/** Pointer to the current position in the pre-processed input stream. */
|
|
1112 |
char *m_cpp_ptr; |
|
1113 |
||
1114 |
/**
|
|
1115 |
Starting position of the last token parsed,
|
|
1116 |
in the pre-processed buffer.
|
|
1117 |
*/
|
|
1118 |
const char *m_cpp_tok_start; |
|
1119 |
||
1120 |
/**
|
|
1121 |
Starting position of the previous token parsed,
|
|
1122 |
in the pre-procedded buffer.
|
|
1123 |
*/
|
|
1124 |
const char *m_cpp_tok_start_prev; |
|
1125 |
||
1126 |
/**
|
|
1127 |
Ending position of the previous token parsed,
|
|
1128 |
in the pre-processed buffer.
|
|
1129 |
*/
|
|
1130 |
const char *m_cpp_tok_end; |
|
1131 |
||
1132 |
/** UTF8-body buffer created during parsing. */
|
|
1133 |
char *m_body_utf8; |
|
1134 |
||
1135 |
/** Pointer to the current position in the UTF8-body buffer. */
|
|
1136 |
char *m_body_utf8_ptr; |
|
1137 |
||
1138 |
/**
|
|
1139 |
Position in the pre-processed buffer. The query from m_cpp_buf to
|
|
1140 |
m_cpp_utf_processed_ptr is converted to UTF8-body.
|
|
1141 |
*/
|
|
1142 |
const char *m_cpp_utf8_processed_ptr; |
|
1143 |
||
1144 |
public: |
|
1145 |
||
1146 |
/** Current state of the lexical analyser. */
|
|
1147 |
enum my_lex_states next_state; |
|
1148 |
||
1149 |
/**
|
|
1150 |
Position of ';' in the stream, to delimit multiple queries.
|
|
1151 |
This delimiter is in the raw buffer.
|
|
1152 |
*/
|
|
1153 |
const char *found_semicolon; |
|
1154 |
||
1155 |
/** Token character bitmaps, to detect 7bit strings. */
|
|
481
by Brian Aker
Remove all of uchar. |
1156 |
unsigned char tok_bitmap; |
1
by brian
clean slate |
1157 |
|
1158 |
/** SQL_MODE = IGNORE_SPACE. */
|
|
1159 |
bool ignore_space; |
|
1160 |
||
1161 |
/** State of the lexical analyser for comments. */
|
|
1162 |
enum_comment_state in_comment; |
|
1163 |
||
1164 |
/**
|
|
1165 |
Starting position of the TEXT_STRING or IDENT in the pre-processed
|
|
1166 |
buffer.
|
|
1167 |
||
520.4.50
by Monty Taylor
Finish changing the bison namespace argument from MYSQL to DRIZZLE |
1168 |
NOTE: this member must be used within DRIZZLElex() function only.
|
1
by brian
clean slate |
1169 |
*/
|
1170 |
const char *m_cpp_text_start; |
|
1171 |
||
1172 |
/**
|
|
1173 |
Ending position of the TEXT_STRING or IDENT in the pre-processed
|
|
1174 |
buffer.
|
|
1175 |
||
520.4.50
by Monty Taylor
Finish changing the bison namespace argument from MYSQL to DRIZZLE |
1176 |
NOTE: this member must be used within DRIZZLElex() function only.
|
1
by brian
clean slate |
1177 |
*/
|
1178 |
const char *m_cpp_text_end; |
|
1179 |
||
1180 |
/**
|
|
1181 |
Character set specified by the character-set-introducer.
|
|
1182 |
||
520.4.50
by Monty Taylor
Finish changing the bison namespace argument from MYSQL to DRIZZLE |
1183 |
NOTE: this member must be used within DRIZZLElex() function only.
|
1
by brian
clean slate |
1184 |
*/
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1185 |
const CHARSET_INFO *m_underscore_cs; |
1
by brian
clean slate |
1186 |
};
|
1187 |
||
1188 |
||
520.1.21
by Brian Aker
THD -> Session rename |
1189 |
/* The state of the lex parsing. This is saved in the Session struct */
|
1
by brian
clean slate |
1190 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1191 |
class LEX : public Query_tables_list |
1
by brian
clean slate |
1192 |
{
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1193 |
public: |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
1194 |
Select_Lex_Unit unit; /* most upper unit */ |
846
by Brian Aker
Removing on typedeffed class. |
1195 |
Select_Lex select_lex; /* first Select_Lex */ |
1196 |
/* current Select_Lex in parsing */
|
|
1197 |
Select_Lex *current_select; |
|
1198 |
/* list of all Select_Lex */
|
|
1199 |
Select_Lex *all_selects_list; |
|
1
by brian
clean slate |
1200 |
|
1201 |
char *length,*dec,*change; |
|
1202 |
LEX_STRING name; |
|
1203 |
String *wild; |
|
831.1.2
by Brian Aker
Rename class file_exchange |
1204 |
file_exchange *exchange; |
1
by brian
clean slate |
1205 |
select_result *result; |
1206 |
Item *default_value, *on_update_value; |
|
1207 |
LEX_STRING comment, ident; |
|
1208 |
XID *xid; |
|
481
by Brian Aker
Remove all of uchar. |
1209 |
unsigned char* yacc_yyss, *yacc_yyvs; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
1210 |
Session *session; |
1
by brian
clean slate |
1211 |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1212 |
const CHARSET_INFO *charset; |
1
by brian
clean slate |
1213 |
bool text_string_is_7bit; |
1214 |
/* store original leaf_tables for INSERT SELECT and PS/SP */
|
|
327.2.4
by Brian Aker
Refactoring table.h |
1215 |
TableList *leaf_tables_insert; |
1
by brian
clean slate |
1216 |
|
1217 |
List<Key_part_spec> col_list; |
|
1218 |
List<Key_part_spec> ref_list; |
|
1219 |
List<String> interval_list; |
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
1220 |
List<Lex_Column> columns; |
1
by brian
clean slate |
1221 |
List<Item> *insert_list,field_list,value_list,update_list; |
1222 |
List<List_item> many_values; |
|
1223 |
List<set_var_base> var_list; |
|
1224 |
List<Item_param> param_list; |
|
1225 |
/*
|
|
1226 |
A stack of name resolution contexts for the query. This stack is used
|
|
1227 |
at parse time to set local name resolution contexts for various parts
|
|
1228 |
of a query. For example, in a JOIN ... ON (some_condition) clause the
|
|
1229 |
Items in 'some_condition' must be resolved only against the operands
|
|
1230 |
of the the join, and not against the whole clause. Similarly, Items in
|
|
1231 |
subqueries should be resolved against the subqueries (and outer queries).
|
|
1232 |
The stack is used in the following way: when the parser detects that
|
|
1233 |
all Items in some clause need a local context, it creates a new context
|
|
1234 |
and pushes it on the stack. All newly created Items always store the
|
|
1235 |
top-most context in the stack. Once the parser leaves the clause that
|
|
1236 |
required a local context, the parser pops the top-most context.
|
|
1237 |
*/
|
|
1238 |
List<Name_resolution_context> context_stack; |
|
1239 |
List<LEX_STRING> db_list; |
|
1240 |
||
923.1.9
by Brian Aker
More cleanup for old proc and dead code (LCOV) |
1241 |
SQL_LIST auxiliary_table_list, save_list; |
1
by brian
clean slate |
1242 |
Create_field *last_field; |
1243 |
Item_sum *in_sum_func; |
|
942.1.12
by Monty Taylor
Converted udf_func into a factory. |
1244 |
Function_builder *udf; |
1
by brian
clean slate |
1245 |
HA_CHECK_OPT check_opt; // check/repair options |
1246 |
HA_CREATE_INFO create_info; |
|
1247 |
KEY_CREATE_INFO key_create_info; |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
1248 |
uint32_t type; |
1
by brian
clean slate |
1249 |
/*
|
1250 |
This variable is used in post-parse stage to declare that sum-functions,
|
|
1251 |
or functions which have sense only if GROUP BY is present, are allowed.
|
|
1252 |
For example in a query
|
|
1253 |
SELECT ... FROM ...WHERE MIN(i) == 1 GROUP BY ... HAVING MIN(i) > 2
|
|
1254 |
MIN(i) in the WHERE clause is not allowed in the opposite to MIN(i)
|
|
1255 |
in the HAVING clause. Due to possible nesting of select construct
|
|
1256 |
the variable can contain 0 or 1 for each nest level.
|
|
1257 |
*/
|
|
1258 |
nesting_map allow_sum_func; |
|
1259 |
enum_sql_command sql_command; |
|
1260 |
/*
|
|
1261 |
Usually `expr` rule of yacc is quite reused but some commands better
|
|
1262 |
not support subqueries which comes standard with this rule, like
|
|
1263 |
KILL, HA_READ, CREATE/ALTER EVENT etc. Set this to `false` to get
|
|
1264 |
syntax error back.
|
|
1265 |
*/
|
|
1266 |
bool expr_allows_subselect; |
|
1267 |
||
1268 |
thr_lock_type lock_option; |
|
1269 |
enum enum_duplicates duplicates; |
|
1270 |
enum enum_tx_isolation tx_isolation; |
|
1271 |
enum enum_ha_read_modes ha_read_mode; |
|
1272 |
union { |
|
1273 |
enum ha_rkey_function ha_rkey_mode; |
|
1274 |
enum xa_option_words xa_opt; |
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
1275 |
bool lock_transactional; /* For LOCK Table ... IN ... MODE */ |
1
by brian
clean slate |
1276 |
};
|
1277 |
enum enum_var_type option_type; |
|
1278 |
||
202
by Brian Aker
Cleanup sql_lex to modern types. |
1279 |
uint32_t profile_query_id; |
1280 |
uint32_t profile_options; |
|
1
by brian
clean slate |
1281 |
enum column_format_type column_format; |
202
by Brian Aker
Cleanup sql_lex to modern types. |
1282 |
uint32_t which_columns; |
1
by brian
clean slate |
1283 |
enum Foreign_key::fk_match_opt fk_match_option; |
1284 |
enum Foreign_key::fk_option fk_update_opt; |
|
1285 |
enum Foreign_key::fk_option fk_delete_opt; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1286 |
uint32_t slave_session_opt, start_transaction_opt; |
1
by brian
clean slate |
1287 |
int nest_level; |
1288 |
/*
|
|
1289 |
In LEX representing update which were transformed to multi-update
|
|
1290 |
stores total number of tables. For LEX representing multi-delete
|
|
1291 |
holds number of tables from which we will delete records.
|
|
1292 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
1293 |
uint32_t table_count; |
1294 |
uint8_t describe; |
|
1
by brian
clean slate |
1295 |
/*
|
1296 |
A flag that indicates what kinds of derived tables are present in the
|
|
1297 |
query (0 if no derived tables, otherwise DERIVED_SUBQUERY).
|
|
1298 |
*/
|
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
1299 |
uint8_t derived_tables; |
919.1.2
by Brian Aker
Comitting the removal of server code for LOAD DATA "LOCAL" INFILE |
1300 |
bool drop_if_exists, drop_temporary, one_shot_set; |
1
by brian
clean slate |
1301 |
bool autocommit; |
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
1302 |
bool verbose; |
1
by brian
clean slate |
1303 |
|
1304 |
bool tx_chain, tx_release; |
|
1305 |
bool subqueries, ignore; |
|
1306 |
st_parsing_options parsing_options; |
|
1307 |
Alter_info alter_info; |
|
1308 |
||
1309 |
/*
|
|
1310 |
Pointers to part of LOAD DATA statement that should be rewritten
|
|
1311 |
during replication ("LOCAL 'filename' REPLACE INTO" part).
|
|
1312 |
*/
|
|
1313 |
const char *fname_start; |
|
1314 |
const char *fname_end; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1315 |
|
1
by brian
clean slate |
1316 |
/**
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1317 |
During name resolution search only in the table list given by
|
1
by brian
clean slate |
1318 |
Name_resolution_context::first_name_resolution_table and
|
1319 |
Name_resolution_context::last_name_resolution_table
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1320 |
(see Item_field::fix_fields()).
|
1
by brian
clean slate |
1321 |
*/
|
1322 |
bool use_only_table_context; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1323 |
|
1
by brian
clean slate |
1324 |
bool escape_used; |
1325 |
bool is_lex_started; /* If lex_start() did run. For debugging. */ |
|
1326 |
||
575.4.7
by Monty Taylor
More header cleanup. |
1327 |
LEX(); |
1
by brian
clean slate |
1328 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1329 |
virtual ~LEX() |
1
by brian
clean slate |
1330 |
{
|
1331 |
}
|
|
1332 |
||
327.2.4
by Brian Aker
Refactoring table.h |
1333 |
TableList *unlink_first_table(bool *link_to_local); |
1334 |
void link_first_table_back(TableList *first, bool link_to_local); |
|
1
by brian
clean slate |
1335 |
void first_lists_tables_same(); |
1336 |
||
1337 |
bool only_view_structure(); |
|
1338 |
bool need_correct_ident(); |
|
1339 |
||
1340 |
void cleanup_after_one_table_open(); |
|
1341 |
||
1342 |
bool push_context(Name_resolution_context *context) |
|
1343 |
{
|
|
1344 |
return context_stack.push_front(context); |
|
1345 |
}
|
|
1346 |
||
1347 |
void pop_context() |
|
1348 |
{
|
|
1349 |
context_stack.pop(); |
|
1350 |
}
|
|
1351 |
||
1352 |
bool copy_db_to(char **p_db, size_t *p_db_length) const; |
|
1353 |
||
1354 |
Name_resolution_context *current_context() |
|
1355 |
{
|
|
1356 |
return context_stack.head(); |
|
1357 |
}
|
|
1358 |
/*
|
|
520.1.21
by Brian Aker
THD -> Session rename |
1359 |
Restore the LEX and Session in case of a parse error.
|
1
by brian
clean slate |
1360 |
*/
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1361 |
static void cleanup_lex_after_parse_error(Session *session); |
1
by brian
clean slate |
1362 |
|
1363 |
/**
|
|
1364 |
@brief check if the statement is a single-level join
|
|
1365 |
@return result of the check
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1366 |
@retval true The statement doesn't contain subqueries, unions and
|
1
by brian
clean slate |
1367 |
stored procedure calls.
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1368 |
@retval false There are subqueries, UNIONs or stored procedure calls.
|
1
by brian
clean slate |
1369 |
*/
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1370 |
bool is_single_level_stmt() |
1371 |
{
|
|
1372 |
/*
|
|
1
by brian
clean slate |
1373 |
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: |
1374 |
on its top. So select_lex (as the first added) will be at the tail
|
1
by brian
clean slate |
1375 |
of the list.
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1376 |
*/
|
628
by Brian Aker
Collection of dead code removal |
1377 |
if (&select_lex == all_selects_list) |
1
by brian
clean slate |
1378 |
{
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1379 |
assert(!all_selects_list->next_select_in_list()); |
1380 |
return true; |
|
1
by brian
clean slate |
1381 |
}
|
51.1.52
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1382 |
return false; |
1
by brian
clean slate |
1383 |
}
|
575.4.7
by Monty Taylor
More header cleanup. |
1384 |
};
|
1
by brian
clean slate |
1385 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1386 |
extern void lex_start(Session *session); |
1
by brian
clean slate |
1387 |
extern void lex_end(LEX *lex); |
1388 |
||
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1389 |
extern void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str); |
1
by brian
clean slate |
1390 |
|
1391 |
extern bool is_lex_native_function(const LEX_STRING *name); |
|
1392 |
||
1393 |
/**
|
|
1394 |
@} (End of group Semantic_Analysis)
|
|
1395 |
*/
|
|
1396 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1397 |
#endif /* DRIZZLE_SERVER */ |
1014.4.1
by Jay Pipes
Cosmetic: make sql_lex.h include guard match rest of drizzled/ headers. |
1398 |
#endif /* DRIZZLED_SQL_LEX_H */ |