17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_SQL_LEX_H
21
#define DRIZZLED_SQL_LEX_H
23
24
@defgroup Semantic_Analysis Semantic Analysis
25
26
#include <drizzled/message/table.pb.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>
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"
48
class select_result_interceptor;
50
/* YACC and LEX Definitions */
52
/* These may not be declared yet */
58
} /* namespace drizzled */
37
61
The following hack is needed because mysql_yacc.cc does not define
38
62
YYSTYPE before including this file
48
72
# if defined(DRIZZLE_LEX)
49
73
# include <drizzled/foreign_key.h>
50
74
# include <drizzled/lex_symbol.h>
51
# include <drizzled/comp_creator.h>
52
75
# include <drizzled/sql_yacc.h>
53
76
# define LEX_YYSTYPE YYSTYPE *
353
383
inline void unclean() { cleaned= 0; }
354
384
void reinit_exec_mechanism();
356
void print(String *str);
386
void print(String *str, enum_query_type query_type);
358
388
bool add_fake_select_lex(Session *session);
359
389
void init_prepare_fake_select_lex(Session *session);
444
475
Item::cond_result having_value;
445
476
/* point on lex in which it was created, used in view subquery detection */
448
479
/* FROM clause - points to the beginning of the TableList::next_local list. */
449
480
SQL_LIST table_list;
450
481
SQL_LIST group_list; /* GROUP BY clause. */
462
493
by TableList::next_leaf, so leaf_tables points to the left-most leaf.
464
495
TableList *leaf_tables;
465
drizzled::optimizer::select_type type; /* type of select for EXPLAIN */
496
enum drizzled::optimizer::select_type type; /* type of select for EXPLAIN */
467
498
SQL_LIST order_list; /* ORDER clause */
468
499
SQL_LIST *gorder_list;
623
654
bool setup_ref_array(Session *session, uint32_t order_group_num);
624
void print(Session *session, String *str);
625
static void print_order(String *str, Order *order);
627
void print_limit(Session *session, String *str);
655
void print(Session *session, String *str, enum_query_type query_type);
656
static void print_order(String *str,
658
enum_query_type query_type);
659
void print_limit(Session *session, String *str, enum_query_type query_type);
628
660
void fix_prepare_information(Session *session, Item **conds, Item **having_conds);
630
662
Destroy the used execution plan (JOIN) of this subtree (this
638
670
void cleanup_all_joins(bool full);
640
void set_index_hint_type(index_hint_type type, index_clause_map clause);
672
void set_index_hint_type(enum index_hint_type type, index_clause_map clause);
643
675
Add a index hint to the tagged list of hints. The type and clause of the
644
676
hint will be the current ones (set by set_index_hint())
646
void add_index_hint(Session *session, char *str, uint32_t length);
678
bool add_index_hint (Session *session, char *str, uint32_t length);
648
680
/* make a list to hold index hints */
649
681
void alloc_index_hints (Session *session);
661
693
/* current index hint kind. used in filling up index_hints */
662
index_hint_type current_index_hint_type;
694
enum index_hint_type current_index_hint_type;
663
695
index_clause_map current_index_hint_clause;
664
696
/* a list of USE/FORCE/IGNORE INDEX */
665
697
List<Index_hint> *index_hints;
785
817
/* list of all Select_Lex */
786
818
Select_Lex *all_selects_list;
788
/* This is the "scale" for DECIMAL (S,P) notation */
820
/* This is the "scale" for DECIMAL (S,P) notation */
790
822
/* This is the decimal precision in DECIMAL(S,P) notation */
794
* This is used kind of like the "ident" member variable below, as
826
* This is used kind of like the "ident" member variable below, as
795
827
* a place to store certain names of identifiers. Unfortunately, it
796
828
* is used differently depending on the Command (SELECT on a derived
797
829
* table vs CREATE)
807
839
* or a named savepoint. It should probably be refactored out into
808
840
* the eventual Command class built for the Keycache and Savepoint
811
843
LEX_STRING ident;
813
845
unsigned char* yacc_yyss, *yacc_yyvs;
814
846
/* The owning Session of this LEX */
815
847
Session *session;
816
const charset_info_st *charset;
848
const CHARSET_INFO *charset;
817
849
bool text_string_is_7bit;
818
850
/* store original leaf_tables for INSERT SELECT and PS/SP */
819
851
TableList *leaf_tables_insert;
913
945
void cleanup_after_one_table_open();
915
void push_context(Name_resolution_context *context)
947
bool push_context(Name_resolution_context *context)
917
context_stack.push_front(context);
949
return context_stack.push_front(context);
920
952
void pop_context()
1009
1039
return _exists;
1013
1043
bool cacheable;
1014
1044
bool sum_expr_used;
1015
1045
message::Table *_create_table;
1016
message::AlterTable *_alter_table;
1017
1046
message::Table::Field *_create_field;
1021
1050
extern void lex_start(Session *session);
1051
extern void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str);
1052
extern bool is_lex_native_function(const LEX_STRING *name);
1054
bool check_for_sql_keyword(drizzled::st_lex_symbol const&);
1055
bool check_for_sql_keyword(drizzled::lex_string_t const&);
1024
1058
@} (End of group Semantic_Analysis)