26
26
#include <drizzled/message/table.pb.h>
28
#include "drizzled/plugin/function.h"
28
#include "drizzled/sql_udf.h"
29
29
#include "drizzled/name_resolution_context.h"
30
30
#include "drizzled/item/subselect.h"
31
#include "drizzled/item/param.h"
32
#include "drizzled/item/outer_ref.h"
31
33
#include "drizzled/table_list.h"
32
34
#include "drizzled/function/math/real.h"
33
35
#include "drizzled/alter_drop.h"
34
36
#include "drizzled/alter_column.h"
35
#include "drizzled/alter_info.h"
36
#include "drizzled/key_part_spec.h"
37
#include "drizzled/key.h"
38
#include "drizzled/foreign_key.h"
39
#include "drizzled/item/param.h"
37
40
#include "drizzled/index_hint.h"
38
#include "drizzled/statement.h"
39
#include "drizzled/optimizer/explain_plan.h"
47
42
class select_result_interceptor;
68
61
# define LEX_YYSTYPE void *
70
63
# if defined(DRIZZLE_LEX)
71
# include <drizzled/foreign_key.h>
72
64
# include <drizzled/lex_symbol.h>
73
65
# include <drizzled/sql_yacc.h>
74
66
# define LEX_YYSTYPE YYSTYPE *
256
252
static void *operator new(size_t size)
258
return memory::sql_alloc(size);
254
return sql_alloc(size);
260
static void *operator new(size_t size, memory::Root *mem_root)
256
static void *operator new(size_t size, MEM_ROOT *mem_root)
261
257
{ return (void*) alloc_root(mem_root, (uint32_t) size); }
262
258
static void operator delete(void *, size_t)
264
static void operator delete(void *, memory::Root *)
259
{ TRASH(ptr, size); }
260
static void operator delete(void *, MEM_ROOT *)
266
262
Select_Lex_Node(): linkage(UNSPECIFIED_TYPE) {}
267
263
virtual ~Select_Lex_Node() {}
433
429
by TableList::next_leaf, so leaf_tables points to the left-most leaf.
435
431
TableList *leaf_tables;
436
enum drizzled::optimizer::select_type type; /* type of select for EXPLAIN */
432
const char *type; /* type of select for EXPLAIN */
438
434
SQL_LIST order_list; /* ORDER clause */
439
435
SQL_LIST *gorder_list;
513
509
1 - aggregate functions are used in this select,
514
510
defined as SUM_FUNC_USED.
516
std::bitset<2> full_group_by_flag;
512
uint8_t full_group_by_flag;
517
513
void init_query();
518
514
void init_select();
519
515
Select_Lex_Unit* master_unit();
641
637
first_select()->next_select()->linkage == UNION_TYPE;
640
#define ALTER_ADD_COLUMN (1L << 0)
641
#define ALTER_DROP_COLUMN (1L << 1)
642
#define ALTER_CHANGE_COLUMN (1L << 2)
643
#define ALTER_COLUMN_STORAGE (1L << 3)
644
#define ALTER_COLUMN_FORMAT (1L << 4)
645
#define ALTER_COLUMN_ORDER (1L << 5)
646
#define ALTER_ADD_INDEX (1L << 6)
647
#define ALTER_DROP_INDEX (1L << 7)
648
#define ALTER_RENAME (1L << 8)
649
#define ALTER_ORDER (1L << 9)
650
#define ALTER_OPTIONS (1L << 10)
651
#define ALTER_COLUMN_DEFAULT (1L << 11)
652
#define ALTER_KEYS_ONOFF (1L << 12)
653
#define ALTER_STORAGE (1L << 13)
654
#define ALTER_ROW_FORMAT (1L << 14)
655
#define ALTER_CONVERT (1L << 15)
656
#define ALTER_FORCE (1L << 16)
657
#define ALTER_RECREATE (1L << 17)
658
#define ALTER_TABLE_REORG (1L << 24)
659
#define ALTER_FOREIGN_KEY (1L << 31)
662
@brief Parsing data for CREATE or ALTER Table.
664
This structure contains a list of columns or indexes to be created,
671
List<Alter_drop> drop_list;
672
List<Alter_column> alter_list;
674
List<CreateField> create_list;
676
enum enum_enable_or_disable keys_onoff;
677
enum tablespace_op_type tablespace_op;
679
enum ha_build_method build_method;
680
CreateField *datetime_field;
681
bool error_if_not_empty;
685
keys_onoff(LEAVE_AS_IS),
686
tablespace_op(NO_TABLESPACE_OP),
688
build_method(HA_BUILD_DEFAULT),
689
datetime_field(NULL),
690
error_if_not_empty(false)
700
keys_onoff= LEAVE_AS_IS;
701
tablespace_op= NO_TABLESPACE_OP;
703
build_method= HA_BUILD_DEFAULT;
705
error_if_not_empty= false;
707
Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root);
709
Alter_info &operator=(const Alter_info &rhs); // not implemented
710
Alter_info(const Alter_info &rhs); // not implemented
644
713
enum xa_option_words
772
838
file_exchange *exchange;
773
839
select_result *result;
841
/* An item representing the DEFAULT clause in CREATE/ALTER TABLE */
843
/* An item representing the ON UPDATE clause in CREATE/ALTER TABLE */
844
Item *on_update_value;
845
/* Not really sure what exactly goes in here... Comment text at beginning of statement? */
776
849
* This is current used to store the name of a named key cache
777
850
* or a named savepoint. It should probably be refactored out into
795
868
List<Item> *insert_list,field_list,value_list,update_list;
796
869
List<List_item> many_values;
797
870
List<set_var_base> var_list;
871
List<Item_param> param_list;
799
873
A stack of name resolution contexts for the query. This stack is used
800
874
at parse time to set local name resolution contexts for various parts
814
888
SQL_LIST save_list;
815
889
CreateField *last_field;
816
890
Item_sum *in_sum_func;
817
plugin::Function *udf;
891
Function_builder *udf;
892
HA_CHECK_OPT check_opt; // check/repair options
893
HA_CREATE_INFO create_info;
894
drizzled::message::Table *create_table_proto;
895
StorageEngine *show_engine;
896
KEY_CREATE_INFO key_create_info;
820
899
This variable is used in post-parse stage to declare that sum-functions,
828
907
nesting_map allow_sum_func;
829
908
enum_sql_command sql_command;
830
statement::Statement *statement;
832
910
Usually `expr` rule of yacc is quite reused but some commands better
833
911
not support subqueries which comes standard with this rule, like
839
917
thr_lock_type lock_option;
840
918
enum enum_duplicates duplicates;
919
enum enum_tx_isolation tx_isolation;
920
enum enum_ha_read_modes ha_read_mode;
842
922
enum ha_rkey_function ha_rkey_mode;
843
923
enum xa_option_words xa_opt;
845
sql_var_t option_type;
925
enum enum_var_type option_type;
927
enum column_format_type column_format;
928
enum Foreign_key::fk_match_opt fk_match_option;
929
enum Foreign_key::fk_option fk_update_opt;
930
enum Foreign_key::fk_option fk_delete_opt;
931
/* Options used in START TRANSACTION statement */
932
uint32_t start_transaction_opt;
935
In LEX representing update which were transformed to multi-update
936
stores total number of tables. For LEX representing multi-delete
937
holds number of tables from which we will delete records.
939
uint32_t table_count;
848
940
uint8_t describe;
850
942
A flag that indicates what kinds of derived tables are present in the
853
945
uint8_t derived_tables;
947
/* True if "IF EXISTS" used in DROP statement */
949
/* True if "TEMPORARY" used in DROP/CREATE statement */
953
/* Only true when FULL symbol is found (e.g. SHOW FULL PROCESSLIST) */
956
/* Was the CHAIN option using in COMMIT/ROLLBACK? */
958
/* Was the RELEASE option used in COMMIT/ROLLBACK? */
855
960
/* Was the IGNORE symbol found in statement */
962
Alter_info alter_info;
965
Pointers to part of LOAD DATA statement that should be rewritten
966
during replication ("LOCAL 'filename' REPLACE INTO" part).
968
const char *fname_start;
969
const char *fname_end;
859
972
During name resolution search only in the table list given by