summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-04-09 17:03:48 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2016-04-09 17:03:48 +0200
commitcd776fedba3e2902bc25ee206d6e6266e7eb9411 (patch)
tree95bf82d0e0522c6af708cd28639c82e004b5a264 /sql/sql_lex.h
parentf884d233e6a5f68bab846a7bdbd041fc4415ad77 (diff)
parentd516a2ae0cbd09d3b5b1667ec62b421330ab9902 (diff)
downloadmariadb-git-10.2-connector-c-integ.tar.gz
Merge branch '10.2' into 10.2-connector-c-integ10.2-connector-c-integ
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h43
1 files changed, 39 insertions, 4 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index bda4ceb7b91..c64ed6b8d5c 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -48,6 +48,8 @@ class Item_func_match;
class File_parser;
class Key_part_spec;
struct sql_digest_state;
+class With_clause;
+
#define ALLOC_ROOT_SET 1024
@@ -178,6 +180,7 @@ const LEX_STRING sp_data_access_name[]=
#define DERIVED_SUBQUERY 1
#define DERIVED_VIEW 2
+#define DERIVED_WITH 4
enum enum_view_create_mode
{
@@ -540,7 +543,9 @@ public:
List<String> *partition_names= 0,
LEX_STRING *option= 0);
virtual void set_lock_for_tables(thr_lock_type lock_type) {}
-
+ void set_slave(st_select_lex_node *slave_arg) { slave= slave_arg; }
+ st_select_lex_node *insert_chain_before(st_select_lex_node **ptr_pos_to_insert,
+ st_select_lex_node *end_chain_node);
friend class st_select_lex_unit;
friend bool mysql_new_select(LEX *lex, bool move_down);
friend bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
@@ -627,7 +632,7 @@ public:
return saved_fake_select_lex;
return first_select();
};
- //node on wich we should return current_select pointer after parsing subquery
+ //node on which we should return current_select pointer after parsing subquery
st_select_lex *return_to;
/* LIMIT clause runtime counters */
ha_rows select_limit_cnt, offset_limit_cnt;
@@ -638,6 +643,10 @@ public:
derived tables/views handling.
*/
TABLE_LIST *derived;
+ /* With clause attached to this unit (if any) */
+ With_clause *with_clause;
+ /* With element where this unit is used as the specification (if any) */
+ With_element *with_element;
/* thread handler */
THD *thd;
/*
@@ -646,7 +655,7 @@ public:
*/
st_select_lex *fake_select_lex;
/**
- SELECT_LEX that stores LIMIT and OFFSET for UNION ALL when no
+ SELECT_LEX that stores LIMIT and OFFSET for UNION ALL when noq
fake_select_lex is used.
*/
st_select_lex *saved_fake_select_lex;
@@ -662,12 +671,15 @@ public:
*/
TABLE *insert_table_with_stored_vcol;
+ bool columns_are_renamed;
+
void init_query();
st_select_lex* outer_select();
st_select_lex* first_select()
{
return reinterpret_cast<st_select_lex*>(slave);
}
+ void set_with_clause(With_clause *with_cl) { with_clause= with_cl; }
st_select_lex_unit* next_unit()
{
return reinterpret_cast<st_select_lex_unit*>(next);
@@ -1062,6 +1074,19 @@ public:
void set_non_agg_field_used(bool val) { m_non_agg_field_used= val; }
void set_agg_func_used(bool val) { m_agg_func_used= val; }
+ void set_with_clause(With_clause *with_clause)
+ {
+ master_unit()->with_clause= with_clause;
+ }
+ With_clause *get_with_clause()
+ {
+ return master_unit()->with_clause;
+ }
+ With_element *get_with_element()
+ {
+ return master_unit()->with_element;
+ }
+ With_element *find_table_def_in_with_clauses(TABLE_LIST *table);
private:
bool m_non_agg_field_used;
@@ -2409,7 +2434,16 @@ struct LEX: public Query_tables_list
SELECT_LEX *current_select;
/* list of all SELECT_LEX */
SELECT_LEX *all_selects_list;
-
+ /* current with clause in parsing if any, otherwise 0*/
+ With_clause *curr_with_clause;
+ /* pointer to the first with clause in the current statemant */
+ With_clause *with_clauses_list;
+ /*
+ (*with_clauses_list_last_next) contains a pointer to the last
+ with clause in the current statement
+ */
+ With_clause **with_clauses_list_last_next;
+
/* Query Plan Footprint of a currently running select */
Explain_query *explain;
@@ -2475,6 +2509,7 @@ public:
List<Item_func_set_user_var> set_var_list; // in-query assignment list
List<Item_param> param_list;
List<LEX_STRING> view_list; // view list (list of field names in view)
+ List<LEX_STRING> with_column_list; // list of column names in with_list_element
List<LEX_STRING> *column_list; // list of column names (in ANALYZE)
List<LEX_STRING> *index_list; // list of index names (in ANALYZE)
/*