~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.h

  • Committer: Lee Bieber
  • Date: 2011-03-18 04:10:25 UTC
  • mfrom: (2241.1.2 build)
  • Revision ID: kalebral@gmail.com-20110318041025-1xoj1azy6zobhnbm
Merge Stewart - refactoring of default values
Merge Olaf - more refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_SQL_LEX_H
21
 
#define DRIZZLED_SQL_LEX_H
 
20
#pragma once
22
21
 
23
22
/**
24
23
  @defgroup Semantic_Analysis Semantic Analysis
25
24
*/
26
25
#include <drizzled/message/table.pb.h>
27
 
 
28
 
#include "drizzled/plugin/function.h"
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"
35
 
#include "drizzled/alter_info.h"
36
 
#include "drizzled/key_part_spec.h"
37
 
#include "drizzled/index_hint.h"
38
 
#include "drizzled/statement.h"
39
 
#include "drizzled/optimizer/explain_plan.h"
 
26
#include <drizzled/name_resolution_context.h>
 
27
#include <drizzled/table_list.h>
 
28
#include <drizzled/function/math/real.h>
 
29
#include <drizzled/key_part_spec.h>
 
30
#include <drizzled/index_hint.h>
 
31
#include <drizzled/optimizer/explain_plan.h>
40
32
 
41
33
#include <bitset>
42
34
#include <string>
43
35
 
44
 
namespace drizzled
45
 
{
 
36
namespace drizzled {
 
37
 
 
38
namespace plugin { class Function; }
 
39
namespace statement { class Statement; }
 
40
 
 
41
  namespace message
 
42
  {
 
43
    class AlterTable;
 
44
  }
46
45
 
47
46
class st_lex_symbol;
48
47
class select_result_interceptor;
72
71
#  if defined(DRIZZLE_LEX)
73
72
#   include <drizzled/foreign_key.h>
74
73
#   include <drizzled/lex_symbol.h>
 
74
#   include <drizzled/comp_creator.h>
75
75
#   include <drizzled/sql_yacc.h>
76
76
#   define LEX_YYSTYPE YYSTYPE *
77
77
#  else
251
251
      UNCACHEABLE_PREPARE
252
252
  */
253
253
  std::bitset<8> uncacheable;
254
 
  enum sub_select_type linkage;
 
254
  sub_select_type linkage;
255
255
  bool no_table_names_allowed; /* used for global order by */
256
256
  bool no_error; /* suppress error message (convert it to warnings) */
257
257
 
383
383
  inline void unclean() { cleaned= 0; }
384
384
  void reinit_exec_mechanism();
385
385
 
386
 
  void print(String *str, enum_query_type query_type);
 
386
  void print(String *str);
387
387
 
388
388
  bool add_fake_select_lex(Session *session);
389
389
  void init_prepare_fake_select_lex(Session *session);
394
394
  inline bool is_union ();
395
395
 
396
396
  friend void lex_start(Session *session);
397
 
  friend int subselect_union_engine::exec();
398
397
 
399
398
  List<Item> *get_unit_column_types();
400
399
};
475
474
  Item::cond_result having_value;
476
475
  /* point on lex in which it was created, used in view subquery detection */
477
476
  LEX *parent_lex;
478
 
  enum olap_type olap;
 
477
  olap_type olap;
479
478
  /* FROM clause - points to the beginning of the TableList::next_local list. */
480
479
  SQL_LIST table_list;
481
480
  SQL_LIST group_list; /* GROUP BY clause. */
493
492
    by TableList::next_leaf, so leaf_tables points to the left-most leaf.
494
493
  */
495
494
  TableList *leaf_tables;
496
 
  enum drizzled::optimizer::select_type type; /* type of select for EXPLAIN */
 
495
  drizzled::optimizer::select_type type; /* type of select for EXPLAIN */
497
496
 
498
497
  SQL_LIST order_list;                /* ORDER clause */
499
498
  SQL_LIST *gorder_list;
652
651
    init_select();
653
652
  }
654
653
  bool setup_ref_array(Session *session, uint32_t order_group_num);
655
 
  void print(Session *session, String *str, enum_query_type query_type);
656
 
  static void print_order(String *str,
657
 
                          Order *order,
658
 
                          enum_query_type query_type);
659
 
  void print_limit(Session *session, String *str, enum_query_type query_type);
 
654
  void print(Session *session, String *str);
 
655
  static void print_order(String *str, Order *order);
 
656
 
 
657
  void print_limit(Session *session, String *str);
660
658
  void fix_prepare_information(Session *session, Item **conds, Item **having_conds);
661
659
  /*
662
660
    Destroy the used execution plan (JOIN) of this subtree (this
669
667
  */
670
668
  void cleanup_all_joins(bool full);
671
669
 
672
 
  void set_index_hint_type(enum index_hint_type type, index_clause_map clause);
 
670
  void set_index_hint_type(index_hint_type type, index_clause_map clause);
673
671
 
674
672
  /*
675
673
   Add a index hint to the tagged list of hints. The type and clause of the
691
689
 
692
690
private:
693
691
  /* current index hint kind. used in filling up index_hints */
694
 
  enum index_hint_type current_index_hint_type;
 
692
  index_hint_type current_index_hint_type;
695
693
  index_clause_map current_index_hint_clause;
696
694
  /* a list of USE/FORCE/IGNORE INDEX */
697
695
  List<Index_hint> *index_hints;
801
799
 
802
800
} /* namespace drizzled */
803
801
 
804
 
#include "drizzled/lex_input_stream.h"
 
802
#include <drizzled/lex_input_stream.h>
805
803
 
806
804
namespace drizzled
807
805
{
817
815
  /* list of all Select_Lex */
818
816
  Select_Lex *all_selects_list;
819
817
 
820
 
  /* This is the "scale" for DECIMAL (S,P) notation */ 
 
818
  /* This is the "scale" for DECIMAL (S,P) notation */
821
819
  char *length;
822
820
  /* This is the decimal precision in DECIMAL(S,P) notation */
823
821
  char *dec;
824
 
  
 
822
 
825
823
  /**
826
 
   * This is used kind of like the "ident" member variable below, as 
 
824
   * This is used kind of like the "ident" member variable below, as
827
825
   * a place to store certain names of identifiers.  Unfortunately, it
828
826
   * is used differently depending on the Command (SELECT on a derived
829
827
   * table vs CREATE)
839
837
   * or a named savepoint.  It should probably be refactored out into
840
838
   * the eventual Command class built for the Keycache and Savepoint
841
839
   * commands.
842
 
   */ 
 
840
   */
843
841
  LEX_STRING ident;
844
842
 
845
843
  unsigned char* yacc_yyss, *yacc_yyvs;
958
956
 
959
957
  Name_resolution_context *current_context()
960
958
  {
961
 
    return context_stack.head();
 
959
    return &context_stack.front();
962
960
  }
963
961
 
964
962
  /**
1019
1017
    return _create_table;
1020
1018
  }
1021
1019
 
 
1020
  message::AlterTable *alter_table();
 
1021
 
1022
1022
  message::Table::Field *field()
1023
1023
  {
1024
1024
    return _create_field;
1039
1039
    return _exists;
1040
1040
  }
1041
1041
 
1042
 
private: 
 
1042
private:
1043
1043
  bool cacheable;
1044
1044
  bool sum_expr_used;
1045
1045
  message::Table *_create_table;
 
1046
  message::AlterTable *_alter_table;
1046
1047
  message::Table::Field *_create_field;
1047
1048
  bool _exists;
1048
1049
};
1061
1062
} /* namespace drizzled */
1062
1063
 
1063
1064
#endif /* DRIZZLE_SERVER */
1064
 
#endif /* DRIZZLED_SQL_LEX_H */