~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.h

  • Committer: Monty Taylor
  • Date: 2011-03-10 18:09:05 UTC
  • mfrom: (2225.2.2 refactor)
  • mto: This revision was merged to the branch mainline in revision 2228.
  • Revision ID: mordred@inaugust.com-20110310180905-ttx05t7q7ff6nl7c
Merge Olad: Refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
  @defgroup Semantic_Analysis Semantic Analysis
25
25
*/
26
26
#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"
 
27
#include <drizzled/name_resolution_context.h>
 
28
#include <drizzled/table_list.h>
 
29
#include <drizzled/function/math/real.h>
 
30
#include <drizzled/key_part_spec.h>
 
31
#include <drizzled/index_hint.h>
 
32
#include <drizzled/statement.h>
 
33
#include <drizzled/optimizer/explain_plan.h>
40
34
 
41
35
#include <bitset>
42
36
#include <string>
43
37
 
44
 
namespace drizzled
45
 
{
46
 
 
 
38
namespace drizzled {
 
39
 
 
40
namespace plugin { class Function; }
 
41
 
 
42
class st_lex_symbol;
47
43
class select_result_interceptor;
48
44
 
49
45
/* YACC and LEX Definitions */
294
290
  {}
295
291
 
296
292
  friend class Select_Lex_Unit;
297
 
  friend bool mysql_new_select(LEX *lex, bool move_down);
 
293
  friend bool new_select(LEX *lex, bool move_down);
298
294
private:
299
295
  void fast_exclude();
300
296
};
382
378
  inline void unclean() { cleaned= 0; }
383
379
  void reinit_exec_mechanism();
384
380
 
385
 
  void print(String *str, enum_query_type query_type);
 
381
  void print(String *str);
386
382
 
387
383
  bool add_fake_select_lex(Session *session);
388
384
  void init_prepare_fake_select_lex(Session *session);
393
389
  inline bool is_union ();
394
390
 
395
391
  friend void lex_start(Session *session);
396
 
  friend int subselect_union_engine::exec();
397
392
 
398
393
  List<Item> *get_unit_column_types();
399
394
};
449
444
    n_sum_items(0),
450
445
    n_child_sum_items(0),
451
446
    explicit_limit(0),
 
447
    is_cross(false),
452
448
    subquery_in_having(0),
453
449
    is_correlated(0),
454
450
    exclude_from_table_unique_test(0),
533
529
 
534
530
  /* explicit LIMIT clause was used */
535
531
  bool explicit_limit;
 
532
 
 
533
  /* explicit CROSS JOIN was used */
 
534
  bool is_cross;
 
535
 
536
536
  /*
537
537
    there are subquery in HAVING clause => we can't close tables before
538
538
    query processing end even if we use temporary table
628
628
    order_list.next= (unsigned char**) &order_list.first;
629
629
  }
630
630
  /*
631
 
    This method created for reiniting LEX in mysql_admin_table() and can be
 
631
    This method created for reiniting LEX in admin_table() and can be
632
632
    used only if you are going remove all Select_Lex & units except belonger
633
633
    to LEX (LEX::unit & LEX::select, for other purposes there are
634
634
    Select_Lex_Unit::exclude_level & Select_Lex_Unit::exclude_tree
646
646
    init_select();
647
647
  }
648
648
  bool setup_ref_array(Session *session, uint32_t order_group_num);
649
 
  void print(Session *session, String *str, enum_query_type query_type);
650
 
  static void print_order(String *str,
651
 
                          Order *order,
652
 
                          enum_query_type query_type);
653
 
  void print_limit(Session *session, String *str, enum_query_type query_type);
 
649
  void print(Session *session, String *str);
 
650
  static void print_order(String *str, Order *order);
 
651
 
 
652
  void print_limit(Session *session, String *str);
654
653
  void fix_prepare_information(Session *session, Item **conds, Item **having_conds);
655
654
  /*
656
655
    Destroy the used execution plan (JOIN) of this subtree (this
795
794
 
796
795
} /* namespace drizzled */
797
796
 
798
 
#include "drizzled/lex_input_stream.h"
 
797
#include <drizzled/lex_input_stream.h>
799
798
 
800
799
namespace drizzled
801
800
{
850
849
  List<Lex_Column>    columns;
851
850
  List<Item>          *insert_list,field_list,value_list,update_list;
852
851
  List<List_item>     many_values;
853
 
  List<set_var_base>  var_list;
 
852
  SetVarVector  var_list;
854
853
  /*
855
854
    A stack of name resolution contexts for the query. This stack is used
856
855
    at parse time to set local name resolution contexts for various parts
930
929
     statement in a session. It's re-used by doing lex_end, lex_start
931
930
     in sql_lex.cc
932
931
  */
933
 
  virtual ~LEX()
934
 
  {
935
 
  }
 
932
  virtual ~LEX();
936
933
 
937
934
  TableList *unlink_first_table(bool *link_to_local);
938
935
  void link_first_table_back(TableList *first, bool link_to_local);
954
951
 
955
952
  Name_resolution_context *current_context()
956
953
  {
957
 
    return context_stack.head();
 
954
    return &context_stack.front();
958
955
  }
959
 
  /*
960
 
    Restore the LEX and Session in case of a parse error.
961
 
  */
962
 
  static void cleanup_lex_after_parse_error(Session *session);
963
956
 
964
957
  /**
965
958
    @brief check if the statement is a single-level join
995
988
  void reset()
996
989
  {
997
990
    sum_expr_used= false;
 
991
    _exists= false;
998
992
  }
999
993
 
1000
994
  void setSumExprUsed()
1010
1004
  void start(Session *session);
1011
1005
  void end();
1012
1006
 
 
1007
  message::Table *table()
 
1008
  {
 
1009
    if (not _create_table)
 
1010
      _create_table= new message::Table;
 
1011
 
 
1012
    return _create_table;
 
1013
  }
 
1014
 
 
1015
  message::Table::Field *field()
 
1016
  {
 
1017
    return _create_field;
 
1018
  }
 
1019
 
 
1020
  void setField(message::Table::Field *arg)
 
1021
  {
 
1022
    _create_field= arg;
 
1023
  }
 
1024
 
 
1025
  void setExists()
 
1026
  {
 
1027
    _exists= true;
 
1028
  }
 
1029
 
 
1030
  bool exists() const
 
1031
  {
 
1032
    return _exists;
 
1033
  }
 
1034
 
1013
1035
private: 
1014
1036
  bool cacheable;
1015
1037
  bool sum_expr_used;
 
1038
  message::Table *_create_table;
 
1039
  message::Table::Field *_create_field;
 
1040
  bool _exists;
1016
1041
};
1017
1042
 
1018
1043
extern void lex_start(Session *session);
1019
1044
extern void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str);
1020
1045
extern bool is_lex_native_function(const LEX_STRING *name);
1021
1046
 
 
1047
bool check_for_sql_keyword(drizzled::st_lex_symbol const&);
 
1048
bool check_for_sql_keyword(drizzled::lex_string_t const&);
 
1049
 
1022
1050
/**
1023
1051
  @} (End of group Semantic_Analysis)
1024
1052
*/