diff options
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 22895d7a2d8..d5afa0a89dd 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -749,6 +749,7 @@ typedef struct system_status_var /* The following are for internal temporary tables */ ulong ha_tmp_update_count; ulong ha_tmp_write_count; + ulong ha_tmp_delete_count; ulong ha_prepare_count; ulong ha_icp_attempts; ulong ha_icp_match; @@ -4862,17 +4863,22 @@ public: }; -class select_union :public select_result_interceptor +class select_unit :public select_result_interceptor { + uint curr_step, prev_step, curr_sel; + enum sub_select_type step; public: + Item_int *intersect_mark; TMP_TABLE_PARAM tmp_table_param; int write_err; /* Error code from the last send_data->ha_write_row call. */ -public: TABLE *table; ha_rows records; - select_union(THD *thd_arg): - select_result_interceptor(thd_arg), write_err(0), table(0), records(0) + select_unit(THD *thd_arg): + select_result_interceptor(thd_arg), + curr_step(0), prev_step(0), curr_sel(UINT_MAX), + step(UNION_TYPE), intersect_mark(0), write_err(0), table(0), + records(0) { tmp_table_param.init(); } int prepare(List<Item> &list, SELECT_LEX_UNIT *u); /** @@ -4894,12 +4900,13 @@ public: const char *alias, bool bit_fields_as_long, bool create_table, - bool keep_row_order= FALSE); + bool keep_row_order, + uint hidden); TMP_TABLE_PARAM *get_tmp_table_param() { return &tmp_table_param; } + void change_select(); }; - -class select_union_recursive :public select_union +class select_union_recursive :public select_unit { public: /* The temporary table with the new records generated by one iterative step */ @@ -4910,7 +4917,7 @@ class select_union_recursive :public select_union List<TABLE> rec_tables; select_union_recursive(THD *thd_arg): - select_union(thd_arg), + select_unit(thd_arg), incr_table(0), first_rec_table_to_update(0) {}; int send_data(List<Item> &items); @@ -4919,7 +4926,8 @@ class select_union_recursive :public select_union const char *alias, bool bit_fields_as_long, bool create_table, - bool keep_row_order= FALSE); + bool keep_row_order, + uint hidden); void cleanup(); }; @@ -4936,7 +4944,7 @@ class select_union_recursive :public select_union have a global ORDER BY clause. @see st_select_lex_unit::prepare(). */ -class select_union_direct :public select_union +class select_union_direct :public select_unit { private: /* Result object that receives all rows */ @@ -4962,7 +4970,7 @@ public: ha_rows send_records; select_union_direct(THD *thd_arg, select_result *result_arg, SELECT_LEX *last_select_lex_arg): - select_union(thd_arg), result(result_arg), + select_unit(thd_arg), result(result_arg), last_select_lex(last_select_lex_arg), done_send_result_set_metadata(false), done_initialize_tables(false), limit_found_rows(0) @@ -5045,7 +5053,7 @@ public: about NULLs. */ -class select_materialize_with_stats : public select_union +class select_materialize_with_stats : public select_unit { protected: class Column_statistics @@ -5078,14 +5086,15 @@ protected: void reset(); public: - select_materialize_with_stats(THD *thd_arg): select_union(thd_arg) + select_materialize_with_stats(THD *thd_arg): select_unit(thd_arg) { tmp_table_param.init(); } bool create_result_table(THD *thd, List<Item> *column_types, bool is_distinct, ulonglong options, const char *alias, bool bit_fields_as_long, bool create_table, - bool keep_row_order= FALSE); + bool keep_row_order, + uint hidden); bool init_result_table(ulonglong select_options); int send_data(List<Item> &items); void cleanup(); @@ -5650,6 +5659,17 @@ inline int handler::ha_write_tmp_row(uchar *buf) return error; } +inline int handler::ha_delete_tmp_row(uchar *buf) +{ + int error; + MYSQL_DELETE_ROW_START(table_share->db.str, table_share->table_name.str); + increment_statistics(&SSV::ha_tmp_delete_count); + TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_DELETE_ROW, MAX_KEY, 0, + { error= delete_row(buf); }) + MYSQL_DELETE_ROW_DONE(error); + return error; +} + inline int handler::ha_update_tmp_row(const uchar *old_data, uchar *new_data) { int error; |