diff options
Diffstat (limited to 'sql/sql_help.cc')
-rw-r--r-- | sql/sql_help.cc | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 858205f8da6..9b2295f6fb3 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -188,11 +188,14 @@ int search_topics(THD *thd, TABLE *topics, struct st_find_field *find_fields, SQL_SELECT *select, List<String> *names, String *name, String *description, String *example) { - DBUG_ENTER("search_topics"); int count= 0; - READ_RECORD read_record_info; - init_read_record(&read_record_info, thd, topics, select, 1, 0, FALSE); + DBUG_ENTER("search_topics"); + + /* Should never happen. As this is part of help, we can ignore this */ + if (init_read_record(&read_record_info, thd, topics, select, 1, 0, FALSE)) + DBUG_RETURN(0); + while (!read_record_info.read_record(&read_record_info)) { if (!select->cond->val_int()) // Doesn't match like @@ -228,11 +231,13 @@ int search_topics(THD *thd, TABLE *topics, struct st_find_field *find_fields, int search_keyword(THD *thd, TABLE *keywords, struct st_find_field *find_fields, SQL_SELECT *select, int *key_id) { - DBUG_ENTER("search_keyword"); int count= 0; - READ_RECORD read_record_info; - init_read_record(&read_record_info, thd, keywords, select, 1, 0, FALSE); + DBUG_ENTER("search_keyword"); + /* Should never happen. As this is part of help, we can ignore this */ + if (init_read_record(&read_record_info, thd, keywords, select, 1, 0, FALSE)) + DBUG_RETURN(0); + while (!read_record_info.read_record(&read_record_info) && count<2) { if (!select->cond->val_int()) // Dosn't match like @@ -302,13 +307,13 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations, rkey_id->store((longlong) key_id, TRUE); rkey_id->get_key_image(buff, rkey_id->pack_length(), Field::itRAW); - int key_res= relations->file->index_read_map(relations->record[0], - buff, (key_part_map) 1, - HA_READ_KEY_EXACT); + int key_res= relations->file->ha_index_read_map(relations->record[0], + buff, (key_part_map) 1, + HA_READ_KEY_EXACT); for ( ; !key_res && key_id == (int16) rkey_id->val_int() ; - key_res= relations->file->index_next(relations->record[0])) + key_res= relations->file->ha_index_next(relations->record[0])) { uchar topic_id_buff[8]; longlong topic_id= rtopic_id->val_int(); @@ -316,8 +321,8 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations, field->store((longlong) topic_id, TRUE); field->get_key_image(topic_id_buff, field->pack_length(), Field::itRAW); - if (!topics->file->index_read_map(topics->record[0], topic_id_buff, - (key_part_map)1, HA_READ_KEY_EXACT)) + if (!topics->file->ha_index_read_map(topics->record[0], topic_id_buff, + (key_part_map)1, HA_READ_KEY_EXACT)) { memorize_variant_topic(thd,topics,count,find_fields, names,name,description,example); @@ -355,10 +360,11 @@ int search_categories(THD *thd, TABLE *categories, Field *pcat_id= find_fields[help_category_help_category_id].field; int count= 0; READ_RECORD read_record_info; - DBUG_ENTER("search_categories"); - init_read_record(&read_record_info, thd, categories, select,1,0,FALSE); + /* Should never happen. As this is part of help, we can ignore this */ + if (init_read_record(&read_record_info, thd, categories, select,1,0,FALSE)) + DBUG_RETURN(0); while (!read_record_info.read_record(&read_record_info)) { if (select && !select->cond->val_int()) @@ -389,10 +395,13 @@ int search_categories(THD *thd, TABLE *categories, void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname, SQL_SELECT *select, List<String> *res) { + READ_RECORD read_record_info; DBUG_ENTER("get_all_items_for_category"); - READ_RECORD read_record_info; - init_read_record(&read_record_info, thd, items, select,1,0,FALSE); + /* Should never happen. As this is part of help, we can ignore this */ + if (init_read_record(&read_record_info, thd, items, select,1,0,FALSE)) + DBUG_VOID_RETURN; + while (!read_record_info.read_record(&read_record_info)) { if (!select->cond->val_int()) @@ -534,7 +543,8 @@ int send_variant_2_list(MEM_ROOT *mem_root, Protocol *protocol, String **end= pointers + names->elements; List_iterator<String> it(*names); - for (pos= pointers; pos!=end; (*pos++= it++)) ; + for (pos= pointers; pos!=end; (*pos++= it++)) + ; my_qsort(pointers,names->elements,sizeof(String*),string_ptr_cmp); |