diff options
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r-- | sql/sql_select.h | 77 |
1 files changed, 15 insertions, 62 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h index d4e06f42249..ce8ee69ae3c 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -30,11 +30,17 @@ #include "procedure.h" #include "sql_array.h" /* Array */ +#include "sql_class.h" +#include "sql_lex.h" #include "records.h" /* READ_RECORD */ #include "opt_range.h" /* SQL_SELECT, QUICK_SELECT_I */ #include "filesort.h" -typedef struct st_join_table JOIN_TAB; +class POSITION; +#ifndef TMP_ENGINE_COLUMNDEF +class TMP_ENGINE_COLUMNDEF; +#endif + /* Values in optimize */ #define KEY_OPTIMIZE_EXISTS 1U #define KEY_OPTIMIZE_REF_OR_NULL 2U @@ -199,6 +205,8 @@ enum join_type { JT_UNKNOWN,JT_SYSTEM,JT_CONST,JT_EQ_REF,JT_REF,JT_MAYBE_REF, JT_HASH, JT_HASH_RANGE, JT_HASH_NEXT, JT_HASH_INDEX_MERGE}; class JOIN; +struct st_join_table; +using JOIN_TAB= struct st_join_table; enum enum_nested_loop_state { @@ -250,7 +258,7 @@ class Filesort; struct SplM_plan_info; class SplM_opt_info; -typedef struct st_join_table { +struct st_join_table { TABLE *table; TABLE_LIST *tab_list; KEYUSE *keyuse; /**< pointer to first used key */ @@ -649,16 +657,7 @@ typedef struct st_join_table { If this join_tab reads a non-merged semi-join (also called jtbm), return the select's number. Otherwise, return 0. */ - int get_non_merged_semijoin_select() const - { - Item_in_subselect *subq; - if (table->pos_in_table_list && - (subq= table->pos_in_table_list->jtbm_subselect)) - { - return subq->unit->first_select()->select_number; - } - return 0; /* Not a merged semi-join */ - } + int get_non_merged_semijoin_select() const; bool access_from_tables_is_allowed(table_map used_tables, table_map sjm_lookup_tables) @@ -686,7 +685,7 @@ typedef struct st_join_table { table_map remaining_tables); bool fix_splitting(SplM_plan_info *spl_plan, table_map remaining_tables, bool is_const_table); -} JOIN_TAB; +}; #include "sql_join_cache.h" @@ -1663,12 +1662,7 @@ public: Return the table for which an index scan can be used to satisfy the sort order needed by the ORDER BY/(implicit) GROUP BY clause */ - JOIN_TAB *get_sort_by_join_tab() - { - return (need_tmp || !sort_by_table || skip_sort_order || - ((group || tmp_table_param.sum_func_count) && !group_list)) ? - NULL : join_tab+const_tables; - } + JOIN_TAB *get_sort_by_join_tab(); bool setup_subquery_caches(); bool shrink_join_buffers(JOIN_TAB *jt, ulonglong curr_space, @@ -1839,19 +1833,7 @@ public: @details this function makes sure truncation warnings when preparing the key buffers don't end up as errors (because of an enclosing INSERT/UPDATE). */ - enum store_key_result copy(THD *thd) - { - enum store_key_result result; - enum_check_fields org_count_cuted_fields= thd->count_cuted_fields; - sql_mode_t org_sql_mode= thd->variables.sql_mode; - thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE); - thd->variables.sql_mode|= MODE_INVALID_DATES; - thd->count_cuted_fields= CHECK_FIELD_IGNORE; - result= copy_inner(); - thd->count_cuted_fields= org_count_cuted_fields; - thd->variables.sql_mode= org_sql_mode; - return result; - } + enum store_key_result copy(THD *thd); protected: Field *to_field; // Store data here @@ -1937,36 +1919,7 @@ public: const char *name() const override { return "func"; } protected: - enum store_key_result copy_inner() override - { - TABLE *table= to_field->table; - MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, - &table->write_set); - int res= FALSE; - - /* - It looks like the next statement is needed only for a simplified - hash function over key values used now in BNLH join. - When the implementation of this function will be replaced for a proper - full version this statement probably should be removed. - */ - to_field->reset(); - - if (use_value) - item->save_val(to_field); - else - res= item->save_in_field(to_field, 1); - /* - Item::save_in_field() may call Item::val_xxx(). And if this is a subquery - we need to check for errors executing it and react accordingly - */ - if (!res && table->in_use->is_error()) - res= 1; /* STORE_KEY_FATAL */ - dbug_tmp_restore_column_map(&table->write_set, old_map); - null_key= to_field->is_null() || item->null_value; - return ((err != 0 || res < 0 || res > 2) ? STORE_KEY_FATAL : - (store_key_result) res); - } + enum store_key_result copy_inner() override; }; |