diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index acb29743356..abb1d891166 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -35,11 +35,10 @@ const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref", "MAYBE_REF","ALL","range","index","fulltext" }; static bool make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, - DYNAMIC_ARRAY *keyuse,List<Item_func_match> &ftfuncs); + DYNAMIC_ARRAY *keyuse); static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse, JOIN_TAB *join_tab, - uint tables,COND *conds,table_map table_map, - List<Item_func_match> &ftfuncs); + uint tables,COND *conds,table_map table_map); static int sort_keyuse(KEYUSE *a,KEYUSE *b); static void set_position(JOIN *join,uint index,JOIN_TAB *table,KEYUSE *key); static void find_best_combination(JOIN *join,table_map rest_tables); @@ -156,7 +155,6 @@ int handle_select(THD *thd, LEX *lex, select_result *result) res=mysql_select(thd,(TABLE_LIST*) select_lex->table_list.first, select_lex->item_list, select_lex->where, - select_lex->ftfunc_list, (ORDER*) select_lex->order_list.first, (ORDER*) select_lex->group_list.first, select_lex->having, @@ -177,7 +175,6 @@ int handle_select(THD *thd, LEX *lex, select_result *result) int mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, - List<Item_func_match> &ftfuncs, ORDER *order, ORDER *group,Item *having,ORDER *proc_param, ulong select_options,select_result *result) { @@ -220,7 +217,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, if (having->with_sum_func) having->split_sum_func(all_fields); } - if (setup_ftfuncs(thd,tables,ftfuncs)) /* should be after having->fix_fields */ + if (setup_ftfuncs(thd)) /* should be after having->fix_fields */ DBUG_RETURN(-1); /* Check if one one uses a not constant column with group functions @@ -408,8 +405,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, /* Calculate how to do the join */ thd->proc_info="statistics"; - if (make_join_statistics(&join,tables,conds,&keyuse,ftfuncs) || - thd->fatal_error) + if (make_join_statistics(&join,tables,conds,&keyuse) || thd->fatal_error) goto err; thd->proc_info="preparing"; result->initialize_tables(&join); @@ -532,7 +528,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, make_join_readinfo(&join, (select_options & (SELECT_DESCRIBE | SELECT_NO_JOIN_CACHE)) | - (ftfuncs.elements ? SELECT_NO_JOIN_CACHE : 0)); + (thd->lex.select_lex.ftfunc_list.elements ? SELECT_NO_JOIN_CACHE : 0)); /* Need to tell Innobase that to play it safe, it should fetch all columns of the tables: this is because MySQL @@ -599,18 +595,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, } /* Perform FULLTEXT search before all regular searches */ - if (ftfuncs.elements) - { - List_iterator_fast<Item_func_match> li(ftfuncs); - Item_func_match *ifm; - DBUG_PRINT("info",("Performing FULLTEXT search")); - thd->proc_info="FULLTEXT search init"; + init_ftfuncs(thd,test(order)); - while ((ifm=li++)) - { - ifm->init_search(test(order)); - } - } /* Create a tmp table if distinct or if the sort is too complicated */ if (need_tmp) { @@ -902,8 +888,7 @@ static ha_rows get_quick_record_count(SQL_SELECT *select,TABLE *table, static bool make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, - DYNAMIC_ARRAY *keyuse_array, - List<Item_func_match> &ftfuncs) + DYNAMIC_ARRAY *keyuse_array) { int error; uint i,table_count,const_count,found_ref,refs,key,const_ref,eq_part; @@ -1015,7 +1000,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, if (conds || outer_join) if (update_ref_and_keys(join->thd,keyuse_array,stat,join->tables, - conds,~outer_join,ftfuncs)) + conds,~outer_join)) DBUG_RETURN(1); /* loop until no more const tables are found */ @@ -1524,8 +1509,7 @@ sort_keyuse(KEYUSE *a,KEYUSE *b) static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, - uint tables, COND *cond, table_map normal_tables, - List<Item_func_match> &ftfuncs) + uint tables, COND *cond, table_map normal_tables) { uint and_level,i,found_eq_constant; @@ -1553,7 +1537,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, add_key_part(keyuse,field); } - if (ftfuncs.elements) + if (thd->lex.select_lex.ftfunc_list.elements) { add_ft_keys(keyuse,join_tab,cond,normal_tables); } @@ -1561,7 +1545,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, /* ** remove ref if there is a keypart which is a ref and a const. ** remove keyparts without previous keyparts. - ** Special treatment for ft-keys. SerG. + ** Special treatment for ft-keys. */ if (keyuse->elements) { |