Loading myisam/ft_search.c +2 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key, ALL_IN_ONE aio; FT_DOCLIST *dlist; FT_DOC *dptr; my_off_t saved_lastpos=((MI_INFO *)info)->lastpos; /* black magic ON */ if ((int) (keynr = _mi_check_index((MI_INFO *)info,keynr)) < 0) Loading Loading @@ -204,6 +205,7 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key, delete_tree(&aio.dtree); delete_tree(wtree); my_free((char*) wtree,MYF(0)); ((MI_INFO *)info)->lastpos=saved_lastpos; return dlist; } Loading sql/ha_myisam.cc +11 −1 Original line number Diff line number Diff line Loading @@ -1094,7 +1094,17 @@ int ha_myisam::ft_read(byte * buf) if (error=ft_read_next((FT_DOCLIST *) ft_handler,(char*) buf)) ft_handler=NULL; // Magic here ! See Item_func_match::val() // and ha_myisam::index_init() table->status=error ? STATUS_NOT_FOUND: 0; return error; } int ha_myisam::index_init(uint idx) { if (idx != active_index) ft_handler=NULL; // Magic here ! active_index=idx; return 0; } sql/ha_myisam.h +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ class ha_myisam: public handler int index_first(byte * buf); int index_last(byte * buf); int index_next_same(byte *buf, const byte *key, uint keylen); int index_init(uint idx); int ft_init() { if(!ft_handler) return 1; ft_reinit_search(ft_handler); return 0; } void *ft_init_ext(uint inx,const byte *key, uint keylen, bool presort) Loading sql/item_func.cc +6 −3 Original line number Diff line number Diff line Loading @@ -1840,9 +1840,12 @@ longlong Item_func_inet_aton::val_int() double Item_func_match::val() { // Don't know how to return an error from val(), so NULL will be returned if ((null_value=(ft_handler==NULL))) return 0.0; /* If called uninitialized we should return neither NULL nor 0 (important for const_tables) so, let's return -1, which is obviously incorrect for normal operation, and could be easily spotted */ if (ft_handler==NULL) return -1.0; if (join_key) { Loading sql/opt_range.cc +5 −2 Original line number Diff line number Diff line Loading @@ -393,7 +393,7 @@ QUICK_SELECT::QUICK_SELECT(TABLE *table,uint key_nr,bool no_alloc) else bzero((char*) &alloc,sizeof(alloc)); file=head->file; error=file->index_init(index); // error=file->index_init(index); record=head->record[0]; } Loading @@ -403,13 +403,16 @@ QUICK_SELECT::~QUICK_SELECT() free_root(&alloc,MYF(0)); } int QUICK_SELECT::init() { return error=file->index_init(index); } QUICK_RANGE::QUICK_RANGE() :min_key(0),max_key(0),min_length(0),max_length(0), flag(NO_MIN_RANGE | NO_MAX_RANGE) {} SEL_ARG::SEL_ARG(SEL_ARG &arg) :Sql_alloc() { type=arg.type; Loading Loading
myisam/ft_search.c +2 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key, ALL_IN_ONE aio; FT_DOCLIST *dlist; FT_DOC *dptr; my_off_t saved_lastpos=((MI_INFO *)info)->lastpos; /* black magic ON */ if ((int) (keynr = _mi_check_index((MI_INFO *)info,keynr)) < 0) Loading Loading @@ -204,6 +205,7 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key, delete_tree(&aio.dtree); delete_tree(wtree); my_free((char*) wtree,MYF(0)); ((MI_INFO *)info)->lastpos=saved_lastpos; return dlist; } Loading
sql/ha_myisam.cc +11 −1 Original line number Diff line number Diff line Loading @@ -1094,7 +1094,17 @@ int ha_myisam::ft_read(byte * buf) if (error=ft_read_next((FT_DOCLIST *) ft_handler,(char*) buf)) ft_handler=NULL; // Magic here ! See Item_func_match::val() // and ha_myisam::index_init() table->status=error ? STATUS_NOT_FOUND: 0; return error; } int ha_myisam::index_init(uint idx) { if (idx != active_index) ft_handler=NULL; // Magic here ! active_index=idx; return 0; }
sql/ha_myisam.h +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ class ha_myisam: public handler int index_first(byte * buf); int index_last(byte * buf); int index_next_same(byte *buf, const byte *key, uint keylen); int index_init(uint idx); int ft_init() { if(!ft_handler) return 1; ft_reinit_search(ft_handler); return 0; } void *ft_init_ext(uint inx,const byte *key, uint keylen, bool presort) Loading
sql/item_func.cc +6 −3 Original line number Diff line number Diff line Loading @@ -1840,9 +1840,12 @@ longlong Item_func_inet_aton::val_int() double Item_func_match::val() { // Don't know how to return an error from val(), so NULL will be returned if ((null_value=(ft_handler==NULL))) return 0.0; /* If called uninitialized we should return neither NULL nor 0 (important for const_tables) so, let's return -1, which is obviously incorrect for normal operation, and could be easily spotted */ if (ft_handler==NULL) return -1.0; if (join_key) { Loading
sql/opt_range.cc +5 −2 Original line number Diff line number Diff line Loading @@ -393,7 +393,7 @@ QUICK_SELECT::QUICK_SELECT(TABLE *table,uint key_nr,bool no_alloc) else bzero((char*) &alloc,sizeof(alloc)); file=head->file; error=file->index_init(index); // error=file->index_init(index); record=head->record[0]; } Loading @@ -403,13 +403,16 @@ QUICK_SELECT::~QUICK_SELECT() free_root(&alloc,MYF(0)); } int QUICK_SELECT::init() { return error=file->index_init(index); } QUICK_RANGE::QUICK_RANGE() :min_key(0),max_key(0),min_length(0),max_length(0), flag(NO_MIN_RANGE | NO_MAX_RANGE) {} SEL_ARG::SEL_ARG(SEL_ARG &arg) :Sql_alloc() { type=arg.type; Loading