~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.h

  • Committer: Andrew Hutchings
  • Date: 2010-10-20 15:31:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1907.
  • Revision ID: andrew@linuxjedi.co.uk-20101020153127-w9djuz9omzezg2kz
Add error message for global sort buffer constraint

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
44
44
namespace drizzled
45
45
{
46
46
 
47
 
class st_lex_symbol;
48
47
class select_result_interceptor;
49
48
 
50
49
/* YACC and LEX Definitions */
63
62
*/
64
63
 
65
64
#ifdef DRIZZLE_SERVER
66
 
/* set_var should change to set_var here ... */
67
 
# include <drizzled/sys_var.h>
 
65
# include <drizzled/set_var.h>
68
66
# include <drizzled/item/func.h>
69
67
# ifdef DRIZZLE_YACC
70
68
#  define LEX_YYSTYPE void *
295
293
  {}
296
294
 
297
295
  friend class Select_Lex_Unit;
298
 
  friend bool new_select(LEX *lex, bool move_down);
 
296
  friend bool mysql_new_select(LEX *lex, bool move_down);
299
297
private:
300
298
  void fast_exclude();
301
299
};
405
403
class Select_Lex: public Select_Lex_Node
406
404
{
407
405
public:
408
 
 
409
 
  Select_Lex() :
410
 
    context(),
411
 
    db(0),
412
 
    where(0),
413
 
    having(0),
414
 
    cond_value(),
415
 
    having_value(),
416
 
    parent_lex(0),
417
 
    olap(UNSPECIFIED_OLAP_TYPE),
418
 
    table_list(),
419
 
    group_list(),
420
 
    item_list(),
421
 
    interval_list(),
422
 
    is_item_list_lookup(false),
423
 
    join(0),
424
 
    top_join_list(),
425
 
    join_list(0),
426
 
    embedding(0),
427
 
    sj_nests(),
428
 
    leaf_tables(0),
429
 
    type(optimizer::ST_PRIMARY),
430
 
    order_list(),
431
 
    gorder_list(0),
432
 
    select_limit(0),
433
 
    offset_limit(0),
434
 
    ref_pointer_array(0),
435
 
    select_n_having_items(0),
436
 
    cond_count(0),
437
 
    between_count(0),
438
 
    max_equal_elems(0),
439
 
    select_n_where_fields(0),
440
 
    parsing_place(NO_MATTER),
441
 
    with_sum_func(0),
442
 
    in_sum_expr(0),
443
 
    select_number(0),
444
 
    nest_level(0),
445
 
    inner_sum_func_list(0),
446
 
    with_wild(0),
447
 
    braces(0),
448
 
    having_fix_field(0),
449
 
    inner_refs_list(),
450
 
    n_sum_items(0),
451
 
    n_child_sum_items(0),
452
 
    explicit_limit(0),
453
 
    is_cross(false),
454
 
    subquery_in_having(0),
455
 
    is_correlated(0),
456
 
    exclude_from_table_unique_test(0),
457
 
    non_agg_fields(),
458
 
    cur_pos_in_select_list(0),
459
 
    prev_join_using(0),
460
 
    full_group_by_flag(),
461
 
    current_index_hint_type(INDEX_HINT_IGNORE),
462
 
    current_index_hint_clause(),
463
 
    index_hints(0)
464
 
  {
465
 
  }
466
 
 
467
406
  Name_resolution_context context;
468
407
  char *db;
469
408
  /* An Item representing the WHERE clause */
535
474
 
536
475
  /* explicit LIMIT clause was used */
537
476
  bool explicit_limit;
538
 
 
539
 
  /* explicit CROSS JOIN was used */
540
 
  bool is_cross;
541
 
 
542
477
  /*
543
478
    there are subquery in HAVING clause => we can't close tables before
544
479
    query processing end even if we use temporary table
634
569
    order_list.next= (unsigned char**) &order_list.first;
635
570
  }
636
571
  /*
637
 
    This method created for reiniting LEX in admin_table() and can be
 
572
    This method created for reiniting LEX in mysql_admin_table() and can be
638
573
    used only if you are going remove all Select_Lex & units except belonger
639
574
    to LEX (LEX::unit & LEX::select, for other purposes there are
640
575
    Select_Lex_Unit::exclude_level & Select_Lex_Unit::exclude_tree
646
581
  bool test_limit();
647
582
 
648
583
  friend void lex_start(Session *session);
 
584
  Select_Lex() : n_sum_items(0), n_child_sum_items(0) {}
649
585
  void make_empty_select()
650
586
  {
651
587
    init_query();
654
590
  bool setup_ref_array(Session *session, uint32_t order_group_num);
655
591
  void print(Session *session, String *str, enum_query_type query_type);
656
592
  static void print_order(String *str,
657
 
                          Order *order,
 
593
                          order_st *order,
658
594
                          enum_query_type query_type);
659
595
  void print_limit(Session *session, String *str, enum_query_type query_type);
660
596
  void fix_prepare_information(Session *session, Item **conds, Item **having_conds);
856
792
  List<Lex_Column>    columns;
857
793
  List<Item>          *insert_list,field_list,value_list,update_list;
858
794
  List<List_item>     many_values;
859
 
  SetVarVector  var_list;
 
795
  List<set_var_base>  var_list;
860
796
  /*
861
797
    A stack of name resolution contexts for the query. This stack is used
862
798
    at parse time to set local name resolution contexts for various parts
936
872
     statement in a session. It's re-used by doing lex_end, lex_start
937
873
     in sql_lex.cc
938
874
  */
939
 
  virtual ~LEX();
 
875
  virtual ~LEX()
 
876
  {
 
877
  }
940
878
 
941
879
  TableList *unlink_first_table(bool *link_to_local);
942
880
  void link_first_table_back(TableList *first, bool link_to_local);
960
898
  {
961
899
    return context_stack.head();
962
900
  }
 
901
  /*
 
902
    Restore the LEX and Session in case of a parse error.
 
903
  */
 
904
  static void cleanup_lex_after_parse_error(Session *session);
963
905
 
964
906
  /**
965
907
    @brief check if the statement is a single-level join
995
937
  void reset()
996
938
  {
997
939
    sum_expr_used= false;
998
 
    _exists= false;
999
940
  }
1000
941
 
1001
942
  void setSumExprUsed()
1007
948
  {
1008
949
    return sum_expr_used;
1009
950
  }
1010
 
 
1011
 
  void start(Session *session);
1012
 
  void end();
1013
 
 
1014
 
  message::Table *table()
1015
 
  {
1016
 
    if (not _create_table)
1017
 
      _create_table= new message::Table;
1018
 
 
1019
 
    return _create_table;
1020
 
  }
1021
 
 
1022
 
  message::Table::Field *field()
1023
 
  {
1024
 
    return _create_field;
1025
 
  }
1026
 
 
1027
 
  void setField(message::Table::Field *arg)
1028
 
  {
1029
 
    _create_field= arg;
1030
 
  }
1031
 
 
1032
 
  void setExists()
1033
 
  {
1034
 
    _exists= true;
1035
 
  }
1036
 
 
1037
 
  bool exists() const
1038
 
  {
1039
 
    return _exists;
1040
 
  }
1041
 
 
1042
951
private: 
1043
952
  bool cacheable;
1044
953
  bool sum_expr_used;
1045
 
  message::Table *_create_table;
1046
 
  message::Table::Field *_create_field;
1047
 
  bool _exists;
1048
954
};
1049
955
 
1050
956
extern void lex_start(Session *session);
 
957
extern void lex_end(LEX *lex);
1051
958
extern void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str);
1052
959
extern bool is_lex_native_function(const LEX_STRING *name);
1053
960
 
1054
 
bool check_for_sql_keyword(drizzled::st_lex_symbol const&);
1055
 
bool check_for_sql_keyword(drizzled::lex_string_t const&);
1056
 
 
1057
961
/**
1058
962
  @} (End of group Semantic_Analysis)
1059
963
*/