~drizzle-trunk/drizzle/development

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"
934.2.1 by Jay Pipes
Split index hints out into their own file, removal from sql_lex.h and sql_select.cc
36
#include "drizzled/key.h"
37
#include "drizzled/foreign_key.h"
38
#include "drizzled/index_hint.h"
1100.3.30 by Padraig O'Sullivan
Renamed the Command class to be Statement. Renamed the command directory to
39
#include "drizzled/statement.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>
42
584.4.7 by Monty Taylor
Removed a big bank of includes from item.h.
43
class select_result_interceptor;
584.1.14 by Monty Taylor
Removed field.h from common_includes.
44
1 by brian
clean slate
45
/* YACC and LEX Definitions */
46
47
/* These may not be declared yet */
48
class Table_ident;
831.1.2 by Brian Aker
Rename class file_exchange
49
class file_exchange;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
50
class Lex_Column;
675 by Brian Aker
Cleanup around item includes.
51
class Item_outer_ref;
1 by brian
clean slate
52
53
/*
54
  The following hack is needed because mysql_yacc.cc does not define
55
  YYSTYPE before including this file
56
*/
57
722.1.4 by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values
58
#ifdef DRIZZLE_SERVER
59
# include <drizzled/set_var.h>
60
# include <drizzled/item/func.h>
61
# ifdef DRIZZLE_YACC
62
#  define LEX_YYSTYPE void *
63
# else
64
#  if defined(DRIZZLE_LEX)
65
#   include <drizzled/lex_symbol.h>
66
#   include <drizzled/sql_yacc.h>
67
#   define LEX_YYSTYPE YYSTYPE *
68
#  else
69
#   define LEX_YYSTYPE void *
70
#  endif /* defined(DRIZZLE_LEX) */
71
# endif /* DRIZZLE_YACC */
72
#endif /* DRIZZLE_SERVER */
1 by brian
clean slate
73
74
// describe/explain types
75
#define DESCRIBE_NORMAL		1
76
#define DESCRIBE_EXTENDED	2
77
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
78
#ifdef DRIZZLE_SERVER
1 by brian
clean slate
79
80
#define DERIVED_NONE	0
81
#define DERIVED_SUBQUERY	1
82
83
typedef List<Item> List_item;
84
85
enum sub_select_type
86
{
1027 by Brian Aker
Merge Jay
87
  UNSPECIFIED_TYPE,
88
  UNION_TYPE,
89
  INTERSECT_TYPE,
90
  EXCEPT_TYPE,
91
  GLOBAL_OPTIONS_TYPE,
92
  DERIVED_TABLE_TYPE,
93
  OLAP_TYPE
1 by brian
clean slate
94
};
95
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
96
enum olap_type
1 by brian
clean slate
97
{
1027 by Brian Aker
Merge Jay
98
  UNSPECIFIED_OLAP_TYPE,
99
  CUBE_TYPE,
100
  ROLLUP_TYPE
1 by brian
clean slate
101
};
102
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
103
/*
104
  The state of the lex parsing for selects
105
1 by brian
clean slate
106
   master and slaves are pointers to select_lex.
107
   master is pointer to upper level node.
108
   slave is pointer to lower level node
109
   select_lex is a SELECT without union
110
   unit is container of either
111
     - One SELECT
112
     - UNION of selects
113
   select_lex and unit are both inherited form select_lex_node
114
   neighbors are two select_lex or units on the same level
115
116
   All select describing structures linked with following pointers:
117
   - list of neighbors (next/prev) (prev of first element point to slave
118
     pointer of upper structure)
119
     - For select this is a list of UNION's (or one element list)
120
     - For units this is a list of sub queries for the upper level select
121
122
   - pointer to master (master), which is
123
     If this is a unit
124
       - pointer to outer select_lex
125
     If this is a select_lex
126
       - pointer to outer unit structure for select
127
128
   - pointer to slave (slave), which is either:
129
     If this is a unit:
130
       - first SELECT that belong to this unit
131
     If this is a select_lex
132
       - first unit that belong to this SELECT (subquries or derived tables)
133
134
   - list of all select_lex (link_next/link_prev)
135
     This is to be used for things like derived tables creation, where we
136
     go through this list and create the derived tables.
137
138
   If unit contain several selects (UNION now, INTERSECT etc later)
139
   then it have special select_lex called fake_select_lex. It used for
140
   storing global parameters (like ORDER BY, LIMIT) and executing union.
141
   Subqueries used in global ORDER BY clause will be attached to this
142
   fake_select_lex, which will allow them correctly resolve fields of
143
   'upper' UNION and outer selects.
144
145
   For example for following query:
146
147
   select *
148
     from table1
149
     where table1.field IN (select * from table1_1_1 union
150
                            select * from table1_1_2)
151
     union
152
   select *
153
     from table2
154
     where table2.field=(select (select f1 from table2_1_1_1_1
155
                                   where table2_1_1_1_1.f2=table2_1_1.f3)
156
                           from table2_1_1
157
                           where table2_1_1.f1=table2.f2)
158
     union
159
   select * from table3;
160
161
   we will have following structure:
162
163
   select1: (select * from table1 ...)
164
   select2: (select * from table2 ...)
165
   select3: (select * from table3)
166
   select1.1.1: (select * from table1_1_1)
167
   ...
168
169
     main unit
170
     fake0
171
     select1 select2 select3
172
     |^^     |^
173
    s|||     ||master
174
    l|||     |+---------------------------------+
175
    a|||     +---------------------------------+|
176
    v|||master                         slave   ||
177
    e||+-------------------------+             ||
178
     V|            neighbor      |             V|
179
     unit1.1<+==================>unit1.2       unit2.1
180
     fake1.1
181
     select1.1.1 select 1.1.2    select1.2.1   select2.1.1
182
                                               |^
183
                                               ||
184
                                               V|
185
                                               unit2.1.1.1
186
                                               select2.1.1.1.1
187
188
189
   relation in main unit will be following:
190
   (bigger picture for:
191
      main unit
192
      fake0
193
      select1 select2 select3
194
   in the above picture)
195
196
         main unit
197
         |^^^^|fake_select_lex
198
         |||||+--------------------------------------------+
199
         ||||+--------------------------------------------+|
200
         |||+------------------------------+              ||
201
         ||+--------------+                |              ||
202
    slave||master         |                |              ||
203
         V|      neighbor |       neighbor |        master|V
204
         select1<========>select2<========>select3        fake0
205
206
    list of all select_lex will be following (as it will be constructed by
207
    parser):
208
209
    select1->select2->select3->select2.1.1->select 2.1.2->select2.1.1.1.1-+
210
                                                                          |
211
    +---------------------------------------------------------------------+
212
    |
213
    +->select1.1.1->select1.1.2
214
215
*/
216
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
217
/*
846 by Brian Aker
Removing on typedeffed class.
218
    Base class for Select_Lex (Select_Lex) &
848 by Brian Aker
typdef class removal (just... use the name of the class).
219
    Select_Lex_Unit (Select_Lex_Unit)
1 by brian
clean slate
220
*/
575.4.7 by Monty Taylor
More header cleanup.
221
class LEX;
846 by Brian Aker
Removing on typedeffed class.
222
class Select_Lex;
848 by Brian Aker
typdef class removal (just... use the name of the class).
223
class Select_Lex_Unit;
847 by Brian Aker
More typdef class removal.
224
class Select_Lex_Node {
1 by brian
clean slate
225
protected:
847 by Brian Aker
More typdef class removal.
226
  Select_Lex_Node *next, **prev,   /* neighbor list */
1 by brian
clean slate
227
    *master, *slave,                  /* vertical links */
846 by Brian Aker
Removing on typedeffed class.
228
    *link_next, **link_prev;          /* list of whole Select_Lex */
1 by brian
clean slate
229
public:
230
151 by Brian Aker
Ulonglong to uint64_t
231
  uint64_t options;
1 by brian
clean slate
232
233
  /*
234
    result of this query can't be cached, bit field, can be :
235
      UNCACHEABLE_DEPENDENT
236
      UNCACHEABLE_RAND
237
      UNCACHEABLE_SIDEEFFECT
238
      UNCACHEABLE_EXPLAIN
239
      UNCACHEABLE_PREPARE
240
  */
202 by Brian Aker
Cleanup sql_lex to modern types.
241
  uint8_t uncacheable;
1 by brian
clean slate
242
  enum sub_select_type linkage;
243
  bool no_table_names_allowed; /* used for global order by */
244
  bool no_error; /* suppress error message (convert it to warnings) */
245
246
  static void *operator new(size_t size)
247
  {
248
    return sql_alloc(size);
249
  }
250
  static void *operator new(size_t size, MEM_ROOT *mem_root)
202 by Brian Aker
Cleanup sql_lex to modern types.
251
  { return (void*) alloc_root(mem_root, (uint32_t) size); }
644 by Brian Aker
Clean up warnings for Solaris.
252
  static void operator delete(void *, size_t)
77.1.7 by Monty Taylor
Heap builds clean.
253
  { TRASH(ptr, size); }
644 by Brian Aker
Clean up warnings for Solaris.
254
  static void operator delete(void *, MEM_ROOT *)
77.1.7 by Monty Taylor
Heap builds clean.
255
  {}
847 by Brian Aker
More typdef class removal.
256
  Select_Lex_Node(): linkage(UNSPECIFIED_TYPE) {}
257
  virtual ~Select_Lex_Node() {}
258
  inline Select_Lex_Node* get_master() { return master; }
1 by brian
clean slate
259
  virtual void init_query();
260
  virtual void init_select();
847 by Brian Aker
More typdef class removal.
261
  void include_down(Select_Lex_Node *upper);
262
  void include_neighbour(Select_Lex_Node *before);
263
  void include_standalone(Select_Lex_Node *sel, Select_Lex_Node **ref);
264
  void include_global(Select_Lex_Node **plink);
1 by brian
clean slate
265
  void exclude();
266
848 by Brian Aker
typdef class removal (just... use the name of the class).
267
  virtual Select_Lex_Unit* master_unit()= 0;
846 by Brian Aker
Removing on typedeffed class.
268
  virtual Select_Lex* outer_select()= 0;
269
  virtual Select_Lex* return_after_parsing()= 0;
1 by brian
clean slate
270
271
  virtual bool set_braces(bool value);
272
  virtual bool inc_in_sum_expr();
202 by Brian Aker
Cleanup sql_lex to modern types.
273
  virtual uint32_t get_in_sum_expr();
327.2.4 by Brian Aker
Refactoring table.h
274
  virtual TableList* get_table_list();
1 by brian
clean slate
275
  virtual List<Item>* get_item_list();
202 by Brian Aker
Cleanup sql_lex to modern types.
276
  virtual uint32_t get_table_join_options();
520.1.22 by Brian Aker
Second pass of thd cleanup
277
  virtual TableList *add_table_to_list(Session *session, Table_ident *table,
77.1.7 by Monty Taylor
Heap builds clean.
278
                                        LEX_STRING *alias,
202 by Brian Aker
Cleanup sql_lex to modern types.
279
                                        uint32_t table_options,
77.1.7 by Monty Taylor
Heap builds clean.
280
                                        thr_lock_type flags= TL_UNLOCK,
281
                                        List<Index_hint> *hints= 0,
1 by brian
clean slate
282
                                        LEX_STRING *option= 0);
644 by Brian Aker
Clean up warnings for Solaris.
283
  virtual void set_lock_for_tables(thr_lock_type)
77.1.7 by Monty Taylor
Heap builds clean.
284
  {}
1 by brian
clean slate
285
848 by Brian Aker
typdef class removal (just... use the name of the class).
286
  friend class Select_Lex_Unit;
575.4.7 by Monty Taylor
More header cleanup.
287
  friend bool mysql_new_select(LEX *lex, bool move_down);
1 by brian
clean slate
288
private:
289
  void fast_exclude();
290
};
291
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
292
/*
848 by Brian Aker
typdef class removal (just... use the name of the class).
293
   Select_Lex_Unit - unit of selects (UNION, INTERSECT, ...) group
846 by Brian Aker
Removing on typedeffed class.
294
   Select_Lexs
1 by brian
clean slate
295
*/
520.1.21 by Brian Aker
THD -> Session rename
296
class Session;
1 by brian
clean slate
297
class select_result;
298
class JOIN;
299
class select_union;
848 by Brian Aker
typdef class removal (just... use the name of the class).
300
class Select_Lex_Unit: public Select_Lex_Node {
1 by brian
clean slate
301
protected:
327.2.4 by Brian Aker
Refactoring table.h
302
  TableList result_table_list;
1 by brian
clean slate
303
  select_union *union_result;
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
304
  Table *table; /* temporary table using for appending UNION results */
1 by brian
clean slate
305
306
  select_result *result;
151 by Brian Aker
Ulonglong to uint64_t
307
  uint64_t found_rows_for_union;
1 by brian
clean slate
308
  bool saved_error;
309
310
public:
311
  bool  prepared, // prepare phase already performed for UNION (unit)
312
    optimized, // optimize phase already performed for UNION (unit)
313
    executed, // already executed
314
    cleaned;
315
316
  // list of fields which points to temporary table for union
317
  List<Item> item_list;
318
  /*
319
    list of types of items inside union (used for union & derived tables)
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
320
1 by brian
clean slate
321
    Item_type_holders from which this list consist may have pointers to Field,
322
    pointers is valid only after preparing SELECTS of this unit and before
323
    any SELECT of this unit execution
324
325
    TODO:
326
    Possibly this member should be protected, and its direct use replaced
327
    by get_unit_column_types(). Check the places where it is used.
328
  */
329
  List<Item> types;
330
  /*
331
    Pointer to 'last' select or pointer to unit where stored
332
    global parameters for union
333
  */
846 by Brian Aker
Removing on typedeffed class.
334
  Select_Lex *global_parameters;
1 by brian
clean slate
335
  //node on wich we should return current_select pointer after parsing subquery
846 by Brian Aker
Removing on typedeffed class.
336
  Select_Lex *return_to;
1 by brian
clean slate
337
  /* LIMIT clause runtime counters */
338
  ha_rows select_limit_cnt, offset_limit_cnt;
339
  /* not NULL if unit used in subselect, point to subselect item */
340
  Item_subselect *item;
341
  /* thread handler */
520.1.22 by Brian Aker
Second pass of thd cleanup
342
  Session *session;
1 by brian
clean slate
343
  /*
846 by Brian Aker
Removing on typedeffed class.
344
    Select_Lex for hidden SELECT in onion which process global
1 by brian
clean slate
345
    ORDER BY and LIMIT
346
  */
846 by Brian Aker
Removing on typedeffed class.
347
  Select_Lex *fake_select_lex;
1 by brian
clean slate
348
846 by Brian Aker
Removing on typedeffed class.
349
  Select_Lex *union_distinct; /* pointer to the last UNION DISTINCT */
1 by brian
clean slate
350
  bool describe; /* union exec() called for EXPLAIN */
351
352
  void init_query();
848 by Brian Aker
typdef class removal (just... use the name of the class).
353
  Select_Lex_Unit* master_unit();
846 by Brian Aker
Removing on typedeffed class.
354
  Select_Lex* outer_select();
355
  Select_Lex* first_select()
356
  {
357
    return reinterpret_cast<Select_Lex*>(slave);
358
  }
848 by Brian Aker
typdef class removal (just... use the name of the class).
359
  Select_Lex_Unit* next_unit()
846 by Brian Aker
Removing on typedeffed class.
360
  {
848 by Brian Aker
typdef class removal (just... use the name of the class).
361
    return reinterpret_cast<Select_Lex_Unit*>(next);
846 by Brian Aker
Removing on typedeffed class.
362
  }
363
  Select_Lex* return_after_parsing() { return return_to; }
1 by brian
clean slate
364
  void exclude_level();
365
  void exclude_tree();
366
367
  /* UNION methods */
892.2.4 by Monty Taylor
Fixed more warnings.
368
  bool prepare(Session *session, select_result *result,
369
               uint64_t additional_options);
1 by brian
clean slate
370
  bool exec();
371
  bool cleanup();
372
  inline void unclean() { cleaned= 0; }
373
  void reinit_exec_mechanism();
374
375
  void print(String *str, enum_query_type query_type);
376
520.1.22 by Brian Aker
Second pass of thd cleanup
377
  bool add_fake_select_lex(Session *session);
378
  void init_prepare_fake_select_lex(Session *session);
1 by brian
clean slate
379
  bool change_result(select_result_interceptor *result,
380
                     select_result_interceptor *old_result);
846 by Brian Aker
Removing on typedeffed class.
381
  void set_limit(Select_Lex *values);
520.1.22 by Brian Aker
Second pass of thd cleanup
382
  void set_session(Session *session_arg) { session= session_arg; }
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
383
  inline bool is_union ();
1 by brian
clean slate
384
520.1.22 by Brian Aker
Second pass of thd cleanup
385
  friend void lex_start(Session *session);
1 by brian
clean slate
386
  friend int subselect_union_engine::exec();
387
388
  List<Item> *get_unit_column_types();
389
};
390
391
/*
846 by Brian Aker
Removing on typedeffed class.
392
  Select_Lex - store information of parsed SELECT statment
1 by brian
clean slate
393
*/
847 by Brian Aker
More typdef class removal.
394
class Select_Lex: public Select_Lex_Node
1 by brian
clean slate
395
{
396
public:
397
  Name_resolution_context context;
398
  char *db;
1014.4.9 by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct
399
  /* An Item representing the WHERE clause */
400
  Item *where;
401
  /* An Item representing the HAVING clause */
402
  Item *having;
1 by brian
clean slate
403
  /* 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
404
  Item::cond_result cond_value;
405
  Item::cond_result having_value;
1 by brian
clean slate
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. */
1014.4.9 by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct
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;
1 by brian
clean slate
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 */
1014.4.9 by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct
431
  /* Arrays of pointers to top elements of all_fields list */
1 by brian
clean slate
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 '*' */
1014.4.9 by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct
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
  */
1089.6.3 by Padraig O'Sullivan
Replaced an instance where a uint8_t type was being used to hold a
506
  std::bitset<2> 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();
1014.4.9 by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct
515
  Select_Lex* next_select()
516
  {
517
    return (Select_Lex*) next;
518
  }
846 by Brian Aker
Removing on typedeffed class.
519
  Select_Lex* next_select_in_list()
520
  {
521
    return (Select_Lex*) link_next;
522
  }
847 by Brian Aker
More typdef class removal.
523
  Select_Lex_Node** next_select_in_list_addr()
1 by brian
clean slate
524
  {
525
    return &link_next;
526
  }
846 by Brian Aker
Removing on typedeffed class.
527
  Select_Lex* return_after_parsing()
1 by brian
clean slate
528
  {
529
    return master_unit()->return_after_parsing();
530
  }
531
846 by Brian Aker
Removing on typedeffed class.
532
  void mark_as_dependent(Select_Lex *last);
1 by brian
clean slate
533
534
  bool set_braces(bool value);
535
  bool inc_in_sum_expr();
202 by Brian Aker
Cleanup sql_lex to modern types.
536
  uint32_t get_in_sum_expr();
1 by brian
clean slate
537
520.1.22 by Brian Aker
Second pass of thd cleanup
538
  bool add_item_to_list(Session *session, Item *item);
539
  bool add_group_to_list(Session *session, Item *item, bool asc);
540
  bool add_order_to_list(Session *session, Item *item, bool asc);
1027 by Brian Aker
Merge Jay
541
  TableList* add_table_to_list(Session *session,
542
                               Table_ident *table,
543
                               LEX_STRING *alias,
544
                               uint32_t table_options,
545
                               thr_lock_type flags= TL_UNLOCK,
546
                               List<Index_hint> *hints= 0,
547
                               LEX_STRING *option= 0);
327.2.4 by Brian Aker
Refactoring table.h
548
  TableList* get_table_list();
520.1.22 by Brian Aker
Second pass of thd cleanup
549
  bool init_nested_join(Session *session);
550
  TableList *end_nested_join(Session *session);
551
  TableList *nest_last_join(Session *session);
327.2.4 by Brian Aker
Refactoring table.h
552
  void add_joined_table(TableList *table);
553
  TableList *convert_right_join();
1 by brian
clean slate
554
  List<Item>* get_item_list();
202 by Brian Aker
Cleanup sql_lex to modern types.
555
  uint32_t get_table_join_options();
1 by brian
clean slate
556
  void set_lock_for_tables(thr_lock_type lock_type);
557
  inline void init_order()
558
  {
559
    order_list.elements= 0;
560
    order_list.first= 0;
481 by Brian Aker
Remove all of uchar.
561
    order_list.next= (unsigned char**) &order_list.first;
1 by brian
clean slate
562
  }
563
  /*
564
    This method created for reiniting LEX in mysql_admin_table() and can be
846 by Brian Aker
Removing on typedeffed class.
565
    used only if you are going remove all Select_Lex & units except belonger
1 by brian
clean slate
566
    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).
567
    Select_Lex_Unit::exclude_level & Select_Lex_Unit::exclude_tree
1 by brian
clean slate
568
  */
1014.4.9 by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct
569
  void cut_subtree()
570
  {
571
    slave= 0;
572
  }
1 by brian
clean slate
573
  bool test_limit();
574
520.1.22 by Brian Aker
Second pass of thd cleanup
575
  friend void lex_start(Session *session);
846 by Brian Aker
Removing on typedeffed class.
576
  Select_Lex() : n_sum_items(0), n_child_sum_items(0) {}
1 by brian
clean slate
577
  void make_empty_select()
578
  {
579
    init_query();
580
    init_select();
581
  }
520.1.22 by Brian Aker
Second pass of thd cleanup
582
  bool setup_ref_array(Session *session, uint32_t order_group_num);
583
  void print(Session *session, String *str, enum_query_type query_type);
1 by brian
clean slate
584
  static void print_order(String *str,
327.2.3 by Brian Aker
Refactoring of class Table
585
                          order_st *order,
1 by brian
clean slate
586
                          enum_query_type query_type);
520.1.22 by Brian Aker
Second pass of thd cleanup
587
  void print_limit(Session *session, String *str, enum_query_type query_type);
588
  void fix_prepare_information(Session *session, Item **conds, Item **having_conds);
1 by brian
clean slate
589
  /*
590
    Destroy the used execution plan (JOIN) of this subtree (this
848 by Brian Aker
typdef class removal (just... use the name of the class).
591
    Select_Lex and all nested Select_Lexes and Select_Lex_Units).
1 by brian
clean slate
592
  */
593
  bool cleanup();
594
  /*
595
    Recursively cleanup the join of this select lex and of all nested
596
    select lexes.
597
  */
598
  void cleanup_all_joins(bool full);
599
600
  void set_index_hint_type(enum index_hint_type type, index_clause_map clause);
601
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
602
  /*
1 by brian
clean slate
603
   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:
604
   hint will be the current ones (set by set_index_hint())
1 by brian
clean slate
605
  */
520.1.22 by Brian Aker
Second pass of thd cleanup
606
  bool add_index_hint (Session *session, char *str, uint32_t length);
1 by brian
clean slate
607
608
  /* make a list to hold index hints */
520.1.22 by Brian Aker
Second pass of thd cleanup
609
  void alloc_index_hints (Session *session);
1 by brian
clean slate
610
  /* read and clear the index hints */
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
611
  List<Index_hint>* pop_index_hints(void)
1 by brian
clean slate
612
  {
613
    List<Index_hint> *hints= index_hints;
614
    index_hints= NULL;
615
    return hints;
616
  }
617
618
  void clear_index_hints(void) { index_hints= NULL; }
619
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
620
private:
1 by brian
clean slate
621
  /* current index hint kind. used in filling up index_hints */
622
  enum index_hint_type current_index_hint_type;
623
  index_clause_map current_index_hint_clause;
624
  /* a list of USE/FORCE/IGNORE INDEX */
625
  List<Index_hint> *index_hints;
626
};
627
848 by Brian Aker
typdef class removal (just... use the name of the class).
628
inline bool Select_Lex_Unit::is_union ()
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
629
{
630
  return first_select()->next_select() &&
1 by brian
clean slate
631
    first_select()->next_select()->linkage == UNION_TYPE;
632
}
633
1014.4.9 by Jay Pipes
Code style cleanup and removal of dead LEX_SERVER_OPTIONS struct
634
enum xa_option_words
635
{
636
  XA_NONE
637
, XA_JOIN
638
, XA_RESUME
639
, XA_ONE_PHASE
640
, XA_SUSPEND
641
, XA_FOR_MIGRATE
642
};
1 by brian
clean slate
643
644
extern const LEX_STRING null_lex_str;
645
646
/*
647
  Class representing list of all tables used by statement.
648
  It also contains information about stored functions used by statement
649
  since during its execution we may have to add all tables used by its
650
  stored functions/triggers to this list in order to pre-open and lock
651
  them.
652
653
  Also used by st_lex::reset_n_backup/restore_backup_query_tables_list()
654
  methods to save and restore this information.
655
*/
656
class Query_tables_list
657
{
658
public:
659
  /* Global list of all tables used by this statement */
327.2.4 by Brian Aker
Refactoring table.h
660
  TableList *query_tables;
1 by brian
clean slate
661
  /* Pointer to next_global member of last element in the previous list. */
327.2.4 by Brian Aker
Refactoring table.h
662
  TableList **query_tables_last;
1 by brian
clean slate
663
  /*
664
    If non-0 then indicates that query requires prelocking and points to
665
    next_global member of last own element in query table list (i.e. last
666
    table which was not added to it as part of preparation to prelocking).
667
    0 - indicates that this query does not need prelocking.
668
  */
327.2.4 by Brian Aker
Refactoring table.h
669
  TableList **query_tables_own_last;
1 by brian
clean slate
670
671
  /*
672
    These constructor and destructor serve for creation/destruction
673
    of Query_tables_list instances which are used as backup storage.
674
  */
675
  Query_tables_list() {}
676
  ~Query_tables_list() {}
677
678
  /* Initializes (or resets) Query_tables_list object for "real" use. */
679
  void reset_query_tables_list(bool init);
680
681
  /*
682
    Direct addition to the list of query tables.
683
    If you are using this function, you must ensure that the table
684
    object, in particular table->db member, is initialized.
685
  */
327.2.4 by Brian Aker
Refactoring table.h
686
  void add_to_query_tables(TableList *table)
1 by brian
clean slate
687
  {
688
    *(table->prev_global= query_tables_last)= table;
689
    query_tables_last= &table->next_global;
690
  }
691
  /* Return pointer to first not-own table in query-tables or 0 */
327.2.4 by Brian Aker
Refactoring table.h
692
  TableList* first_not_own_table()
1 by brian
clean slate
693
  {
694
    return ( query_tables_own_last ? *query_tables_own_last : 0);
695
  }
696
  void chop_off_not_own_tables()
697
  {
698
    if (query_tables_own_last)
699
    {
700
      *query_tables_own_last= 0;
701
      query_tables_last= query_tables_own_last;
702
      query_tables_own_last= 0;
703
    }
704
  }
705
};
706
707
/**
708
  The state of the lexical parser, when parsing comments.
709
*/
710
enum enum_comment_state
711
{
712
  /**
713
    Not parsing comments.
714
  */
715
  NO_COMMENT,
716
  /**
717
    Parsing comments that need to be preserved.
718
    Typically, these are user comments '/' '*' ... '*' '/'.
719
  */
720
  PRESERVE_COMMENT,
721
  /**
722
    Parsing comments that need to be discarded.
723
    Typically, these are special comments '/' '*' '!' ... '*' '/',
724
    or '/' '*' '!' 'M' 'M' 'm' 'm' 'm' ... '*' '/', where the comment
725
    markers should not be expanded.
726
  */
727
  DISCARD_COMMENT
728
};
729
1014.4.8 by Jay Pipes
Split Lex_input_stream out into its own header.
730
#include "drizzled/lex_input_stream.h"
1 by brian
clean slate
731
520.1.21 by Brian Aker
THD -> Session rename
732
/* The state of the lex parsing. This is saved in the Session struct */
575.4.7 by Monty Taylor
More header cleanup.
733
class LEX : public Query_tables_list
1 by brian
clean slate
734
{
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
735
public:
848 by Brian Aker
typdef class removal (just... use the name of the class).
736
  Select_Lex_Unit unit;                         /* most upper unit */
846 by Brian Aker
Removing on typedeffed class.
737
  Select_Lex select_lex;                        /* first Select_Lex */
738
  /* current Select_Lex in parsing */
739
  Select_Lex *current_select;
740
  /* list of all Select_Lex */
741
  Select_Lex *all_selects_list;
1 by brian
clean slate
742
1014.4.5 by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables.
743
  /* This is the "scale" for DECIMAL (S,P) notation */ 
744
  char *length;
745
  /* This is the decimal precision in DECIMAL(S,P) notation */
746
  char *dec;
747
  
1014.4.7 by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable.
748
  /**
749
   * This is used kind of like the "ident" member variable below, as 
750
   * a place to store certain names of identifiers.  Unfortunately, it
751
   * is used differently depending on the Command (SELECT on a derived
752
   * table vs CREATE)
753
   */
1 by brian
clean slate
754
  LEX_STRING name;
1014.4.7 by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable.
755
  /* The string literal used in a LIKE expression */
1 by brian
clean slate
756
  String *wild;
831.1.2 by Brian Aker
Rename class file_exchange
757
  file_exchange *exchange;
1 by brian
clean slate
758
  select_result *result;
1014.4.5 by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables.
759
1014.4.7 by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable.
760
  /**
761
   * This is current used to store the name of a named key cache
762
   * or a named savepoint.  It should probably be refactored out into
763
   * the eventual Command class built for the Keycache and Savepoint
764
   * commands.
765
   */ 
1014.4.5 by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables.
766
  LEX_STRING ident;
767
481 by Brian Aker
Remove all of uchar.
768
  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.
769
  /* The owning Session of this LEX */
520.1.22 by Brian Aker
Second pass of thd cleanup
770
  Session *session;
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
771
  const CHARSET_INFO *charset;
1 by brian
clean slate
772
  bool text_string_is_7bit;
773
  /* store original leaf_tables for INSERT SELECT and PS/SP */
327.2.4 by Brian Aker
Refactoring table.h
774
  TableList *leaf_tables_insert;
1 by brian
clean slate
775
776
  List<Key_part_spec> col_list;
777
  List<Key_part_spec> ref_list;
778
  List<String>	      interval_list;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
779
  List<Lex_Column>    columns;
1 by brian
clean slate
780
  List<Item>	      *insert_list,field_list,value_list,update_list;
781
  List<List_item>     many_values;
782
  List<set_var_base>  var_list;
783
  /*
784
    A stack of name resolution contexts for the query. This stack is used
785
    at parse time to set local name resolution contexts for various parts
786
    of a query. For example, in a JOIN ... ON (some_condition) clause the
787
    Items in 'some_condition' must be resolved only against the operands
788
    of the the join, and not against the whole clause. Similarly, Items in
789
    subqueries should be resolved against the subqueries (and outer queries).
790
    The stack is used in the following way: when the parser detects that
791
    all Items in some clause need a local context, it creates a new context
792
    and pushes it on the stack. All newly created Items always store the
793
    top-most context in the stack. Once the parser leaves the clause that
794
    required a local context, the parser pops the top-most context.
795
  */
796
  List<Name_resolution_context> context_stack;
797
1014.4.5 by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables.
798
  SQL_LIST auxiliary_table_list;
799
  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.
800
  CreateField *last_field;
1 by brian
clean slate
801
  Item_sum *in_sum_func;
1093.1.62 by Monty Taylor
Moved UDFs to slot organization.
802
  drizzled::plugin::Function *udf;
202 by Brian Aker
Cleanup sql_lex to modern types.
803
  uint32_t type;
1 by brian
clean slate
804
  /*
805
    This variable is used in post-parse stage to declare that sum-functions,
806
    or functions which have sense only if GROUP BY is present, are allowed.
807
    For example in a query
808
    SELECT ... FROM ...WHERE MIN(i) == 1 GROUP BY ... HAVING MIN(i) > 2
809
    MIN(i) in the WHERE clause is not allowed in the opposite to MIN(i)
810
    in the HAVING clause. Due to possible nesting of select construct
811
    the variable can contain 0 or 1 for each nest level.
812
  */
813
  nesting_map allow_sum_func;
814
  enum_sql_command sql_command;
1100.3.30 by Padraig O'Sullivan
Renamed the Command class to be Statement. Renamed the command directory to
815
  drizzled::statement::Statement *statement;
1 by brian
clean slate
816
  /*
817
    Usually `expr` rule of yacc is quite reused but some commands better
818
    not support subqueries which comes standard with this rule, like
819
    KILL, HA_READ, CREATE/ALTER EVENT etc. Set this to `false` to get
820
    syntax error back.
821
  */
822
  bool expr_allows_subselect;
823
824
  thr_lock_type lock_option;
825
  enum enum_duplicates duplicates;
826
  union {
827
    enum ha_rkey_function ha_rkey_mode;
828
    enum xa_option_words xa_opt;
829
  };
830
  enum enum_var_type option_type;
831
832
  int nest_level;
202 by Brian Aker
Cleanup sql_lex to modern types.
833
  uint8_t describe;
1 by brian
clean slate
834
  /*
835
    A flag that indicates what kinds of derived tables are present in the
836
    query (0 if no derived tables, otherwise DERIVED_SUBQUERY).
837
  */
202 by Brian Aker
Cleanup sql_lex to modern types.
838
  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.
839
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
840
  /* 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
841
  bool verbose;
1014.4.5 by Jay Pipes
Cleanup of LEX structure. Removed unused xid member variable, documented a number of member variables.
842
  
1014.4.7 by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable.
843
  /* 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.
844
  bool ignore;
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
845
1 by brian
clean slate
846
  /**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
847
    During name resolution search only in the table list given by
1 by brian
clean slate
848
    Name_resolution_context::first_name_resolution_table and
849
    Name_resolution_context::last_name_resolution_table
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
850
    (see Item_field::fix_fields()).
1 by brian
clean slate
851
  */
852
  bool use_only_table_context;
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
853
1014.4.7 by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable.
854
  /* Was the ESCAPE keyword used? */
1 by brian
clean slate
855
  bool escape_used;
856
  bool is_lex_started; /* If lex_start() did run. For debugging. */
857
575.4.7 by Monty Taylor
More header cleanup.
858
  LEX();
1 by brian
clean slate
859
1008.3.17 by Stewart Smith
Start work to construct table proto in parser:
860
  /* Note that init and de-init mostly happen in lex_start and lex_end
861
     and not here. This is because LEX isn't delete/new for each new
862
     statement in a session. It's re-used by doing lex_end, lex_start
863
     in sql_lex.cc
864
  */
575.4.7 by Monty Taylor
More header cleanup.
865
  virtual ~LEX()
1 by brian
clean slate
866
  {
867
  }
868
327.2.4 by Brian Aker
Refactoring table.h
869
  TableList *unlink_first_table(bool *link_to_local);
870
  void link_first_table_back(TableList *first, bool link_to_local);
1 by brian
clean slate
871
  void first_lists_tables_same();
872
873
  bool only_view_structure();
874
  bool need_correct_ident();
875
876
  void cleanup_after_one_table_open();
877
878
  bool push_context(Name_resolution_context *context)
879
  {
880
    return context_stack.push_front(context);
881
  }
882
883
  void pop_context()
884
  {
885
    context_stack.pop();
886
  }
887
888
  bool copy_db_to(char **p_db, size_t *p_db_length) const;
889
890
  Name_resolution_context *current_context()
891
  {
892
    return context_stack.head();
893
  }
894
  /*
520.1.21 by Brian Aker
THD -> Session rename
895
    Restore the LEX and Session in case of a parse error.
1 by brian
clean slate
896
  */
520.1.22 by Brian Aker
Second pass of thd cleanup
897
  static void cleanup_lex_after_parse_error(Session *session);
1 by brian
clean slate
898
899
  /**
900
    @brief check if the statement is a single-level join
901
    @return result of the check
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
902
      @retval true  The statement doesn't contain subqueries, unions and
1 by brian
clean slate
903
                    stored procedure calls.
51.1.52 by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE
904
      @retval false There are subqueries, UNIONs or stored procedure calls.
1 by brian
clean slate
905
  */
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
906
  bool is_single_level_stmt()
907
  {
908
    /*
1 by brian
clean slate
909
      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:
910
      on its top. So select_lex (as the first added) will be at the tail
1 by brian
clean slate
911
      of the list.
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
912
    */
628 by Brian Aker
Collection of dead code removal
913
    if (&select_lex == all_selects_list)
1 by brian
clean slate
914
    {
51.1.52 by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE
915
      assert(!all_selects_list->next_select_in_list());
916
      return true;
1 by brian
clean slate
917
    }
51.1.52 by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE
918
    return false;
1 by brian
clean slate
919
  }
575.4.7 by Monty Taylor
More header cleanup.
920
};
1 by brian
clean slate
921
520.1.22 by Brian Aker
Second pass of thd cleanup
922
extern void lex_start(Session *session);
1 by brian
clean slate
923
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.
924
extern void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str);
1 by brian
clean slate
925
extern bool is_lex_native_function(const LEX_STRING *name);
926
927
/**
928
  @} (End of group Semantic_Analysis)
929
*/
930
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
931
#endif /* DRIZZLE_SERVER */
1014.4.1 by Jay Pipes
Cosmetic: make sql_lex.h include guard match rest of drizzled/ headers.
932
#endif /* DRIZZLED_SQL_LEX_H */