diff options
-rw-r--r-- | sql/sql_class.h | 43 | ||||
-rw-r--r-- | sql/sql_derived.cc | 2 | ||||
-rw-r--r-- | sql/sql_lex.h | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 28 | ||||
-rw-r--r-- | sql/sql_select.h | 39 | ||||
-rw-r--r-- | sql/sql_union.cc | 5 |
6 files changed, 55 insertions, 66 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 4846f5fe9fa..ce109035b2a 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -815,11 +815,52 @@ public: void abort(); }; +#include <myisam.h> + +/* Param to create temporary tables when doing SELECT:s */ + +class TMP_TABLE_PARAM :public Sql_alloc +{ + public: + List<Item> copy_funcs; + List<Item> save_copy_funcs; + List_iterator_fast<Item> copy_funcs_it; + Copy_field *copy_field, *copy_field_end; + Copy_field *save_copy_field, *save_copy_field_end; + byte *group_buff; + Item **items_to_copy; /* Fields in tmp table */ + MI_COLUMNDEF *recinfo,*start_recinfo; + KEY *keyinfo; + ha_rows end_write_records; + uint field_count,sum_func_count,func_count; + uint hidden_field_count; + uint group_parts,group_length,group_null_parts; + uint quick_group; + bool using_indirect_summary_function; + + TMP_TABLE_PARAM() + :copy_funcs_it(copy_funcs), copy_field(0), group_parts(0), + group_length(0), group_null_parts(0) + {} + ~TMP_TABLE_PARAM() + { + cleanup(); + } + inline void cleanup(void) + { + if (copy_field) /* Fix for Intel compiler */ + { + delete [] copy_field; + copy_field=0; + } + } +}; + class select_union :public select_result { public: TABLE *table; COPY_INFO info; - TMP_TABLE_PARAM *tmp_table_param; + TMP_TABLE_PARAM tmp_table_param; bool not_describe; select_union(TABLE *table_par); diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 836c1eb048e..7f555f37d40 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -151,7 +151,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, if ((derived_result=new select_union(table))) { - derived_result->tmp_table_param=&tmp_table_param; + derived_result->tmp_table_param=tmp_table_param; unit->offset_limit_cnt= select_cursor->offset_limit; unit->select_limit_cnt= select_cursor->select_limit+ select_cursor->offset_limit; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 97cf19454ae..47743685890 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -397,7 +397,7 @@ public: friend void mysql_init_query(THD *thd); st_select_lex(struct st_lex *lex); - st_select_lex() {;} + st_select_lex() {} void make_empty_select(st_select_lex *last_select) { select_number=INT_MAX; @@ -480,7 +480,7 @@ typedef struct st_lex CHARSET_INFO *charset; char *help_arg; SQL_LIST *gorder_list; - st_lex() {;} + st_lex() {} inline void uncacheable() { safe_to_cache_query= 0; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bf17497fa19..55567493a4a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1281,16 +1281,10 @@ JOIN::cleanup(THD *thd) JOIN_TAB *tab, *end; for (tab= join_tab, end= tab+tables ; tab != end ; tab++) { - if (tab->select) - { - delete tab->select; - tab->select=0; - } - if (tab->quick) - { - delete tab->quick; - tab->quick=0; - } + delete tab->select; + delete tab->quick; + tab->select=0; + tab->quick=0; x_free(tab->cache.buff); tab->cache.buff= 0; } @@ -3292,16 +3286,10 @@ join_free(JOIN *join, bool full) { for (tab=join->join_tab,end=tab+join->tables ; tab != end ; tab++) { - if (tab->select) - { - delete tab->select; - tab->select=0; - } - if (tab->quick) - { - delete tab->quick; - tab->quick=0; - } + delete tab->select; + delete tab->quick; + tab->select=0; + tab->quick=0; x_free(tab->cache.buff); tab->cache.buff= 0; if (tab->table) diff --git a/sql/sql_select.h b/sql/sql_select.h index ffc98548db4..7f3669f7478 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -113,45 +113,6 @@ typedef struct st_position { /* Used in find_best */ } POSITION; -/* Param to create temporary tables when doing SELECT:s */ - -class TMP_TABLE_PARAM :public Sql_alloc -{ - public: - List<Item> copy_funcs; - List<Item> save_copy_funcs; - List_iterator_fast<Item> copy_funcs_it; - Copy_field *copy_field, *copy_field_end; - Copy_field *save_copy_field, *save_copy_field_end; - byte *group_buff; - Item **items_to_copy; /* Fields in tmp table */ - MI_COLUMNDEF *recinfo,*start_recinfo; - KEY *keyinfo; - ha_rows end_write_records; - uint field_count,sum_func_count,func_count; - uint hidden_field_count; - uint group_parts,group_length,group_null_parts; - uint quick_group; - bool using_indirect_summary_function; - - TMP_TABLE_PARAM() - :copy_funcs_it(copy_funcs), copy_field(0), group_parts(0), - group_length(0), group_null_parts(0) - {} - ~TMP_TABLE_PARAM() - { - cleanup(); - } - inline void cleanup(void) - { - if (copy_field) /* Fix for Intel compiler */ - { - delete [] copy_field; - copy_field=0; - } - } -}; - class JOIN :public Sql_alloc { public: diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 48f536c68cf..fe4ca49da14 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -82,7 +82,7 @@ bool select_union::send_data(List<Item> &values) if (thd->net.last_errno == ER_RECORD_FILE_FULL) { thd->clear_error(); // do not report user about table overflow - if (create_myisam_from_heap(thd, table, tmp_table_param, + if (create_myisam_from_heap(thd, table, &tmp_table_param, info.last_errno, 0)) return 1; } @@ -186,8 +186,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result, goto err; union_result->not_describe=1; - if (!(union_result->tmp_table_param=(TMP_TABLE_PARAM *)thd->memdup((char *)&tmp_table_param, sizeof(TMP_TABLE_PARAM)))) - goto err; + union_result->tmp_table_param=tmp_table_param; /* The following piece of code is placed here solely for the purpose of |