Loading sql/item_func.cc +1 −4 Original line number Diff line number Diff line Loading @@ -1906,10 +1906,7 @@ longlong Item_func_inet_aton::val_int() double Item_func_match::val() { if (ft_handler==NULL) init_search(1); if ((null_value= (ft_handler==NULL))) return 0.0; return -1.0; if (join_key) { Loading sql/mysql_priv.h +2 −2 Original line number Diff line number Diff line Loading @@ -309,7 +309,6 @@ int setup_order(THD *thd,TABLE_LIST *tables, List<Item> &fields, List <Item> &all_fields, ORDER *order); int mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &list,COND *conds, List<Item_func_match> &ftfuncs, ORDER *order, ORDER *group,Item *having,ORDER *proc_param, uint select_type,select_result *result); Field *create_tmp_field(TABLE *table,Item *item, Item::Type type, Loading Loading @@ -417,7 +416,8 @@ bool setup_tables(TABLE_LIST *tables); int setup_fields(THD *thd,TABLE_LIST *tables,List<Item> &item, bool set_query_id,List<Item> *sum_func_list); int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); int setup_ftfuncs(THD *thd,TABLE_LIST *tables, List<Item_func_match> &ftfuncs); int setup_ftfuncs(THD *thd); int init_ftfuncs(THD *thd, bool no_order); void wait_for_refresh(THD *thd); int open_tables(THD *thd,TABLE_LIST *tables); int open_and_lock_tables(THD *thd,TABLE_LIST *tables); Loading sql/sql_base.cc +21 −4 Original line number Diff line number Diff line Loading @@ -2199,17 +2199,18 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, DBUG_RETURN(result); } int setup_ftfuncs(THD *thd,TABLE_LIST *tables, List<Item_func_match> &ftfuncs) int setup_ftfuncs(THD *thd) { List_iterator<Item_func_match> li(ftfuncs), li2(ftfuncs); List_iterator<Item_func_match> li(thd->lex.ftfunc_list), lj(thd->lex.ftfunc_list); Item_func_match *ftf, *ftf2; while ((ftf=li++)) { if (ftf->fix_index()) return 1; li2.rewind(); while ((ftf2=li2++) != ftf) lj.rewind(); while ((ftf2=lj++) != ftf) { if (ftf->eq(ftf2) && !ftf2->master) ftf2->master=ftf; Loading @@ -2218,3 +2219,19 @@ int setup_ftfuncs(THD *thd,TABLE_LIST *tables, List<Item_func_match> &ftfuncs) return 0; } int init_ftfuncs(THD *thd, bool no_order) { List_iterator<Item_func_match> li(thd->lex.ftfunc_list); Item_func_match *ifm; DBUG_PRINT("info",("Performing FULLTEXT search")); thd->proc_info="FULLTEXT initialization"; while ((ifm=li++)) { ifm->init_search(no_order); } return 0; } sql/sql_parse.cc +0 −3 Original line number Diff line number Diff line Loading @@ -1133,7 +1133,6 @@ mysql_execute_command(void) { res=mysql_select(thd,tables,lex->item_list, lex->where, lex->ftfunc_list, (ORDER*) lex->order_list.first, (ORDER*) lex->group_list.first, lex->having, Loading Loading @@ -1283,7 +1282,6 @@ mysql_execute_command(void) { res=mysql_select(thd,tables->next,lex->item_list, lex->where, lex->ftfunc_list, (ORDER*) lex->order_list.first, (ORDER*) lex->group_list.first, lex->having, Loading Loading @@ -1577,7 +1575,6 @@ mysql_execute_command(void) { res=mysql_select(thd,tables->next,lex->item_list, lex->where, lex->ftfunc_list, (ORDER*) lex->order_list.first, (ORDER*) lex->group_list.first, lex->having, Loading sql/sql_select.cc +11 −25 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -150,7 +149,6 @@ static void describe_info(THD *thd, const char *info); 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, uint select_options,select_result *result) { Loading Loading @@ -193,7 +191,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 Loading Loading @@ -378,7 +376,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) || if (make_join_statistics(&join,tables,conds,&keyuse) || thd->fatal_error) goto err; thd->proc_info="preparing"; Loading Loading @@ -494,7 +492,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, test(select_options & OPTION_BUFFER_RESULT))); make_join_readinfo(&join, (select_options & SELECT_DESCRIBE) | (ftfuncs.elements ? 0 : SELECT_USE_CACHE)); // No cache for MATCH (thd->lex.ftfunc_list.elements ? 0 : SELECT_USE_CACHE)); // No cache for MATCH /* Need to tell Innobase that to play it safe, it should fetch all columns of the tables: this is because MySQL Loading Loading @@ -560,18 +558,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<Item_func_match> li(ftfuncs); Item_func_match *ifm; DBUG_PRINT("info",("Performing FULLTEXT search")); thd->proc_info="FULLTEXT searching"; 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) { Loading Loading @@ -833,8 +821,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; Loading Loading @@ -946,7 +933,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 */ Loading Loading @@ -1453,8 +1440,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; Loading Loading @@ -1482,7 +1468,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.ftfunc_list.elements) { add_ft_keys(keyuse,join_tab,cond,normal_tables); } Loading Loading
sql/item_func.cc +1 −4 Original line number Diff line number Diff line Loading @@ -1906,10 +1906,7 @@ longlong Item_func_inet_aton::val_int() double Item_func_match::val() { if (ft_handler==NULL) init_search(1); if ((null_value= (ft_handler==NULL))) return 0.0; return -1.0; if (join_key) { Loading
sql/mysql_priv.h +2 −2 Original line number Diff line number Diff line Loading @@ -309,7 +309,6 @@ int setup_order(THD *thd,TABLE_LIST *tables, List<Item> &fields, List <Item> &all_fields, ORDER *order); int mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &list,COND *conds, List<Item_func_match> &ftfuncs, ORDER *order, ORDER *group,Item *having,ORDER *proc_param, uint select_type,select_result *result); Field *create_tmp_field(TABLE *table,Item *item, Item::Type type, Loading Loading @@ -417,7 +416,8 @@ bool setup_tables(TABLE_LIST *tables); int setup_fields(THD *thd,TABLE_LIST *tables,List<Item> &item, bool set_query_id,List<Item> *sum_func_list); int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); int setup_ftfuncs(THD *thd,TABLE_LIST *tables, List<Item_func_match> &ftfuncs); int setup_ftfuncs(THD *thd); int init_ftfuncs(THD *thd, bool no_order); void wait_for_refresh(THD *thd); int open_tables(THD *thd,TABLE_LIST *tables); int open_and_lock_tables(THD *thd,TABLE_LIST *tables); Loading
sql/sql_base.cc +21 −4 Original line number Diff line number Diff line Loading @@ -2199,17 +2199,18 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, DBUG_RETURN(result); } int setup_ftfuncs(THD *thd,TABLE_LIST *tables, List<Item_func_match> &ftfuncs) int setup_ftfuncs(THD *thd) { List_iterator<Item_func_match> li(ftfuncs), li2(ftfuncs); List_iterator<Item_func_match> li(thd->lex.ftfunc_list), lj(thd->lex.ftfunc_list); Item_func_match *ftf, *ftf2; while ((ftf=li++)) { if (ftf->fix_index()) return 1; li2.rewind(); while ((ftf2=li2++) != ftf) lj.rewind(); while ((ftf2=lj++) != ftf) { if (ftf->eq(ftf2) && !ftf2->master) ftf2->master=ftf; Loading @@ -2218,3 +2219,19 @@ int setup_ftfuncs(THD *thd,TABLE_LIST *tables, List<Item_func_match> &ftfuncs) return 0; } int init_ftfuncs(THD *thd, bool no_order) { List_iterator<Item_func_match> li(thd->lex.ftfunc_list); Item_func_match *ifm; DBUG_PRINT("info",("Performing FULLTEXT search")); thd->proc_info="FULLTEXT initialization"; while ((ifm=li++)) { ifm->init_search(no_order); } return 0; }
sql/sql_parse.cc +0 −3 Original line number Diff line number Diff line Loading @@ -1133,7 +1133,6 @@ mysql_execute_command(void) { res=mysql_select(thd,tables,lex->item_list, lex->where, lex->ftfunc_list, (ORDER*) lex->order_list.first, (ORDER*) lex->group_list.first, lex->having, Loading Loading @@ -1283,7 +1282,6 @@ mysql_execute_command(void) { res=mysql_select(thd,tables->next,lex->item_list, lex->where, lex->ftfunc_list, (ORDER*) lex->order_list.first, (ORDER*) lex->group_list.first, lex->having, Loading Loading @@ -1577,7 +1575,6 @@ mysql_execute_command(void) { res=mysql_select(thd,tables->next,lex->item_list, lex->where, lex->ftfunc_list, (ORDER*) lex->order_list.first, (ORDER*) lex->group_list.first, lex->having, Loading
sql/sql_select.cc +11 −25 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -150,7 +149,6 @@ static void describe_info(THD *thd, const char *info); 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, uint select_options,select_result *result) { Loading Loading @@ -193,7 +191,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 Loading Loading @@ -378,7 +376,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) || if (make_join_statistics(&join,tables,conds,&keyuse) || thd->fatal_error) goto err; thd->proc_info="preparing"; Loading Loading @@ -494,7 +492,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, test(select_options & OPTION_BUFFER_RESULT))); make_join_readinfo(&join, (select_options & SELECT_DESCRIBE) | (ftfuncs.elements ? 0 : SELECT_USE_CACHE)); // No cache for MATCH (thd->lex.ftfunc_list.elements ? 0 : SELECT_USE_CACHE)); // No cache for MATCH /* Need to tell Innobase that to play it safe, it should fetch all columns of the tables: this is because MySQL Loading Loading @@ -560,18 +558,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<Item_func_match> li(ftfuncs); Item_func_match *ifm; DBUG_PRINT("info",("Performing FULLTEXT search")); thd->proc_info="FULLTEXT searching"; 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) { Loading Loading @@ -833,8 +821,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; Loading Loading @@ -946,7 +933,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 */ Loading Loading @@ -1453,8 +1440,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; Loading Loading @@ -1482,7 +1468,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.ftfunc_list.elements) { add_ft_keys(keyuse,join_tab,cond,normal_tables); } Loading