Commit 34c7229a authored by sasha@mysql.sashanet.com's avatar sasha@mysql.sashanet.com

Merge work.mysql.com:/home/bk/mysql

into mysql.sashanet.com:/home/sasha/src/bk/mysql
parents 8f162b8b 342ad607
monty@donna.mysql.com
mwagner@evoq.home.mwagner.org
paul@central.snake.net
sasha@mysql.sashanet.com sasha@mysql.sashanet.com
serg@serg.mysql.com sasha@work.mysql.com
tim@threads.polyesthetic.msg
...@@ -3879,6 +3879,14 @@ Italy [tzone.it] @ ...@@ -3879,6 +3879,14 @@ Italy [tzone.it] @
@c @uref{http://mysql.iol.ie, WWW} @c @uref{http://mysql.iol.ie, WWW}
@c @uref{ftp://ftp.iol.ie/pub/mysql, FTP} @c @uref{ftp://ftp.iol.ie/pub/mysql, FTP}
@item
@c Added 20001031
@c EMAIL: dave@esat.net (Dave Rynne)
@c @image{Flags/ireland}
Ireland [Esat Net] @
@uref{http://ftp.esat.net/mirrors/download.sourceforge.net/pub/mirrors/mysql/, WWW}
@uref{ftp://ftp.esat.net/mirrors/download.sourceforge.net/pub/mirrors/mysql/, FTP}
@item @item
@c EMAIL: W.Sylwestrzak@icm.edu.pl (Wojtek Sylwestrzak) @c EMAIL: W.Sylwestrzak@icm.edu.pl (Wojtek Sylwestrzak)
@c mirroring nightly at 05:25 @c mirroring nightly at 05:25
...@@ -3900,6 +3908,14 @@ Poland [Sunsite] @ ...@@ -3900,6 +3908,14 @@ Poland [Sunsite] @
@c @uref{http://mysql.leirianet.pt, WWW} @c @uref{http://mysql.leirianet.pt, WWW}
@c @uref{ftp://ftp.leirianet.pt/pub/mysql/,FTP} @c @uref{ftp://ftp.leirianet.pt/pub/mysql/,FTP}
@item
@c Added 20001031
@c bofh@netc.pt (Bruno Rodrigues)
@c @image{Flags/portugal}
Portugal [Netc] @
@uref{http://ftp.netc.pt/pub/mysql/, WWW}
@uref{ftp://ftp.netc.pt/pub/mysql/, FTP}
@item @item
@c EMAIL: kuzmin@dn.ru (Roma Kuzmin) @c EMAIL: kuzmin@dn.ru (Roma Kuzmin)
@c @image{Flags/russia} @c @image{Flags/russia}
...@@ -4133,11 +4149,26 @@ USA [LinuxWired/Scottsdale, AZ] @ ...@@ -4133,11 +4149,26 @@ USA [LinuxWired/Scottsdale, AZ] @
@uref{http://mysql.linuxwired.net/, WWW} @uref{http://mysql.linuxwired.net/, WWW}
@uref{ftp://ftp.linuxwired.net/pub/mirrors/mysql/, FTP} @uref{ftp://ftp.linuxwired.net/pub/mirrors/mysql/, FTP}
@item
@c EMAIL: dan@surfsouth.com (Dan Muntz)
@c @image{Flags/usa}
USA [Venoma.Org/Valdosta, GA] @
@uref{http://mysql.venoma.org/, WWW}
@end itemize @end itemize
@strong{South America:} @strong{South America:}
@itemize @bullet @itemize @bullet
@item
@c Added 20001102
@c EMAIL: nico@bannerlandia.com (Nicolas Moldavsky)
@c @image{Flags/argentina}
Argentina [bannerlandia.com] @
@uref{http://mysql.bannerlandia.com.ar/, WWW}
@uref{ftp://mysql.bannerlandia.com.ar/mirrors/mysql/, FTP}
@c @item @c @item
@c Not ok 20000919; Non-existent (Matt) @c Not ok 20000919; Non-existent (Matt)
@c EMAIL: gaiser@matrix.com.br (Roberto Gaiser) @c EMAIL: gaiser@matrix.com.br (Roberto Gaiser)
...@@ -4273,6 +4304,14 @@ Taiwan [TTN] @ ...@@ -4273,6 +4304,14 @@ Taiwan [TTN] @
@c EX: serge@oneway.net @c EX: serge@oneway.net
@c @image{Flags/taiwan} Taiwan [Oneway] @ @c @image{Flags/taiwan} Taiwan [Oneway] @
@c @uref{ftp://ftp.oneway.com.tw/pub/mysql/, FTP} @c @uref{ftp://ftp.oneway.com.tw/pub/mysql/, FTP}
@item
@c Added 20001031
@c EMAIL: ijliao@php.nctu.edu.tw (Ying-Chieh Liao)
@c @image{Flags/taiwan}
Taiwan [nctu.edu/HsinChu] @
@uref{http://mysql.nctu.edu.tw/, WWW}
@end itemize @end itemize
@strong{Australia:} @strong{Australia:}
This diff is collapsed.
...@@ -16,7 +16,7 @@ SHARED_LIB_VERSION=10:0:0 ...@@ -16,7 +16,7 @@ SHARED_LIB_VERSION=10:0:0
# Remember that regexps needs to quote [ and ] since this is run through m4 # Remember that regexps needs to quote [ and ] since this is run through m4
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"` MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"` MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"`
F_PART=`echo $MYSQL_BASE_VERSION | sed -e "s|\.||g"| sed -e "s|[[a-zA-Z]]\+||"` F_PART=`echo $MYSQL_BASE_VERSION | sed -e "s|\.||g"| sed -e "s|[a-zA-Z]\+||"|sed -e "s|^\(..\)$|\\10|"`
L_PART=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|" | sed -e "s|[[a-z]]||"` L_PART=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|" | sed -e "s|[[a-z]]||"`
MYSQL_VERSION_ID=${F_PART}${L_PART} MYSQL_VERSION_ID=${F_PART}${L_PART}
......
...@@ -47,8 +47,9 @@ void ft_free_stopwords(void); ...@@ -47,8 +47,9 @@ void ft_free_stopwords(void);
FT_DOCLIST * ft_init_search(void *, uint, byte *, uint, my_bool); FT_DOCLIST * ft_init_search(void *, uint, byte *, uint, my_bool);
int ft_read_next(FT_DOCLIST *, char *); int ft_read_next(FT_DOCLIST *, char *);
#define ft_close_search(handler) my_free(((gptr)(handler)),MYF(0)) #define ft_close_search(handler) my_free(((gptr)(handler)),MYF(0))
#define ft_get_relevance(handler) ((handler)->doc[(handler)->curdoc].weight) #define ft_get_relevance(handler) ((handler)->doc[(handler)->curdoc].weight)
#define ft_reinit_search(handler) (((FT_DOCLIST *)(handler))->curdoc=-1)
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -158,7 +158,6 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key, ...@@ -158,7 +158,6 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
ALL_IN_ONE aio; ALL_IN_ONE aio;
FT_DOCLIST *dlist; FT_DOCLIST *dlist;
FT_DOC *dptr; FT_DOC *dptr;
my_off_t saved_lastpos;
/* black magic ON */ /* black magic ON */
if ((int) (keynr = _mi_check_index((MI_INFO *)info,keynr)) < 0) if ((int) (keynr = _mi_check_index((MI_INFO *)info,keynr)) < 0)
...@@ -174,8 +173,6 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key, ...@@ -174,8 +173,6 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
aio.keyinfo=aio.info->s->keyinfo+keynr; aio.keyinfo=aio.info->s->keyinfo+keynr;
aio.key_root=aio.info->s->state.key_root[keynr]; aio.key_root=aio.info->s->state.key_root[keynr];
saved_lastpos=aio.info->lastpos;
if (!(wtree=ft_parse(NULL,key,key_len))) return NULL; if (!(wtree=ft_parse(NULL,key,key_len))) return NULL;
init_tree(&aio.dtree,0,sizeof(FT_SUPERDOC),(qsort_cmp)&FT_SUPERDOC_cmp,0, init_tree(&aio.dtree,0,sizeof(FT_SUPERDOC),(qsort_cmp)&FT_SUPERDOC_cmp,0,
...@@ -204,7 +201,6 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key, ...@@ -204,7 +201,6 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
} }
err: err:
aio.info->lastpos=saved_lastpos;
delete_tree(&aio.dtree); delete_tree(&aio.dtree);
delete_tree(wtree); delete_tree(wtree);
my_free((char*) wtree,MYF(0)); my_free((char*) wtree,MYF(0));
......
...@@ -353,7 +353,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -353,7 +353,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
int error = 0; int error = 0;
const char* errmsg = ""; const char* errmsg = "";
if (my_copy(src_path, fn_format(dst_path, table->path, "", if (my_copy(src_path, fn_format(dst_path, table->path, "",
MI_NAME_DEXT, 4), MYF(MY_WME))) MI_NAME_DEXT, 4), MYF(MY_WME)))
{ {
...@@ -361,11 +361,11 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -361,11 +361,11 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
errmsg = "failed in my_copy( Error %d)"; errmsg = "failed in my_copy( Error %d)";
goto err; goto err;
} }
tmp_check_opt.init(); tmp_check_opt.init();
tmp_check_opt.quick = 1; tmp_check_opt.quick = 1;
return repair(thd, &tmp_check_opt); return repair(thd, &tmp_check_opt);
err: err:
{ {
MI_CHECK param; MI_CHECK param;
...@@ -375,7 +375,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -375,7 +375,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
param.table_name = table->table_name; param.table_name = table->table_name;
param.testflag = 0; param.testflag = 0;
mi_check_print_error(&param,errmsg, errno ); mi_check_print_error(&param,errmsg, errno );
return error; return error;
} }
} }
...@@ -450,7 +450,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -450,7 +450,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
llstr(file->state->records, llbuff), llstr(file->state->records, llbuff),
llstr(start_records, llbuff2), llstr(start_records, llbuff2),
table->path); table->path);
} }
return error; return error;
} }
...@@ -496,7 +496,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize) ...@@ -496,7 +496,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
DBUG_RETURN(HA_ADMIN_FAILED); DBUG_RETURN(HA_ADMIN_FAILED);
} }
if (!optimize || if (!optimize ||
((file->state->del || share->state.split != file->state->records) && ((file->state->del || share->state.split != file->state->records) &&
(!param.opt_rep_quick || (!param.opt_rep_quick ||
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS)))) !(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
...@@ -621,9 +621,9 @@ bool ha_myisam::check_and_repair(THD *thd) ...@@ -621,9 +621,9 @@ bool ha_myisam::check_and_repair(THD *thd)
{ {
sql_print_error("Warning: Recovering table: '%s'",table->path); sql_print_error("Warning: Recovering table: '%s'",table->path);
check_opt.quick= !check_opt.retry_without_quick && !marked_crashed; check_opt.quick= !check_opt.retry_without_quick && !marked_crashed;
check_opt.flags=(((myisam_recover_options & HA_RECOVER_BACKUP) ? check_opt.flags=(((myisam_recover_options & HA_RECOVER_BACKUP) ?
T_BACKUP_DATA : 0) | T_BACKUP_DATA : 0) |
(!(myisam_recover_options & HA_RECOVER_FORCE) ? (!(myisam_recover_options & HA_RECOVER_FORCE) ?
T_SAFE_REPAIR : 0)) | T_AUTO_REPAIR; T_SAFE_REPAIR : 0)) | T_AUTO_REPAIR;
if (repair(thd, &check_opt)) if (repair(thd, &check_opt))
error=1; error=1;
...@@ -1079,20 +1079,6 @@ ha_rows ha_myisam::records_in_range(int inx, ...@@ -1079,20 +1079,6 @@ ha_rows ha_myisam::records_in_range(int inx,
end_search_flag); end_search_flag);
} }
int ha_myisam::ft_init(uint inx, const byte *key, uint keylen, bool presort)
{
if (ft_handler)
return -1;
// Do the search!
ft_handler=ft_init_search(file,inx,(byte*) key,keylen,presort);
if (!ft_handler)
return (my_errno ? my_errno : -1);
return 0;
}
int ha_myisam::ft_read(byte * buf) int ha_myisam::ft_read(byte * buf)
{ {
int error; int error;
...@@ -1102,7 +1088,8 @@ int ha_myisam::ft_read(byte * buf) ...@@ -1102,7 +1088,8 @@ int ha_myisam::ft_read(byte * buf)
thread_safe_increment(ha_read_next_count,&LOCK_status); // why ? thread_safe_increment(ha_read_next_count,&LOCK_status); // why ?
error=ft_read_next((FT_DOCLIST *) ft_handler,(char*) buf); if (error=ft_read_next((FT_DOCLIST *) ft_handler,(char*) buf))
ft_handler=NULL; // Magic here ! See Item_func_match::val()
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
......
...@@ -71,8 +71,9 @@ class ha_myisam: public handler ...@@ -71,8 +71,9 @@ class ha_myisam: public handler
int index_first(byte * buf); int index_first(byte * buf);
int index_last(byte * buf); int index_last(byte * buf);
int index_next_same(byte *buf, const byte *key, uint keylen); int index_next_same(byte *buf, const byte *key, uint keylen);
int ft_init(uint inx,const byte *key, uint keylen, bool presort=1); int ft_init()
void *ft_init_ext(uint inx,const byte *key, uint keylen, bool presort=0) { 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)
{ return ft_init_search(file,inx,(byte*) key,keylen,presort); } { return ft_init_search(file,inx,(byte*) key,keylen,presort); }
int ft_read(byte *buf); int ft_read(byte *buf);
int rnd_init(bool scan=1); int rnd_init(bool scan=1);
......
...@@ -222,9 +222,9 @@ public: ...@@ -222,9 +222,9 @@ public:
virtual int index_first(byte * buf)=0; virtual int index_first(byte * buf)=0;
virtual int index_last(byte * buf)=0; virtual int index_last(byte * buf)=0;
virtual int index_next_same(byte *buf, const byte *key, uint keylen); virtual int index_next_same(byte *buf, const byte *key, uint keylen);
virtual int ft_init(uint inx,const byte *key, uint keylen, bool presort=1) virtual int ft_init()
{ return -1; } { return -1; }
virtual void *ft_init_ext(uint inx,const byte *key, uint keylen, bool presort=0) virtual void *ft_init_ext(uint inx,const byte *key, uint keylen, bool presort)
{ return (void *)NULL; } { return (void *)NULL; }
virtual int ft_read(byte *buf) { return -1; } virtual int ft_read(byte *buf) { return -1; }
virtual int rnd_init(bool scan=1)=0; virtual int rnd_init(bool scan=1)=0;
...@@ -257,7 +257,7 @@ public: ...@@ -257,7 +257,7 @@ public:
virtual int restore(THD* thd, HA_CHECK_OPT* check_opt); virtual int restore(THD* thd, HA_CHECK_OPT* check_opt);
// assumes .frm file must exist, and you must have already called // assumes .frm file must exist, and you must have already called
// generate_table() - it will just copy the data file and run repair // generate_table() - it will just copy the data file and run repair
virtual int dump(THD* thd, int fd = -1) { return ER_DUMP_NOT_IMPLEMENTED; } virtual int dump(THD* thd, int fd = -1) { return ER_DUMP_NOT_IMPLEMENTED; }
virtual void deactivate_non_unique_index(ha_rows rows) {} virtual void deactivate_non_unique_index(ha_rows rows) {}
virtual bool activate_all_index(THD *thd) {return 0;} virtual bool activate_all_index(THD *thd) {return 0;}
......
...@@ -1840,73 +1840,71 @@ err: ...@@ -1840,73 +1840,71 @@ err:
double Item_func_match::val() double Item_func_match::val()
{ {
if (first_call)
init_search();
// Don't know how to return an error from val(), so NULL will be returned // Don't know how to return an error from val(), so NULL will be returned
if ((null_value=(ft_handler==NULL))) if ((null_value=(ft_handler==NULL)))
return 0.0; return 0.0;
if (join_key) if (join_key)
{ {
return ft_get_relevance(ft_handler); if (table->file->ft_handler)
return ft_get_relevance(ft_handler);
join_key=0; // Magic here ! See ha_myisam::ft_read()
} }
else
{
/* implicit initialization was done, so we'll have to find
ft_relevance manually in ft_handler array */
int a,b,c; /* we'll have to find ft_relevance manually in ft_handler array */
FT_DOC *docs=ft_handler->doc;
my_off_t docid=table->file->row_position();
if ((null_value=(docid==HA_OFFSET_ERROR))) int a,b,c;
return 0.0; FT_DOC *docs=ft_handler->doc;
my_off_t docid=table->file->row_position();
// Assuming docs[] is sorted by dpos... if ((null_value=(docid==HA_OFFSET_ERROR)))
return 0.0;
for (a=0, b=ft_handler->ndocs, c=(a+b)/2; b-a>1; c=(a+b)/2) // Assuming docs[] is sorted by dpos...
{
if (docs[c].dpos > docid) for (a=0, b=ft_handler->ndocs, c=(a+b)/2; b-a>1; c=(a+b)/2)
b=c; {
else if (docs[c].dpos > docid)
a=c; b=c;
}
if (docs[a].dpos == docid)
return docs[a].weight;
else else
return 0.0; a=c;
} }
if (docs[a].dpos == docid)
return docs[a].weight;
else
return 0.0;
} }
void Item_func_match::init_search() void Item_func_match::init_search(bool no_order)
{ {
if (!first_call) if (ft_handler)
return; return;
first_call=false;
if (master) if (master)
{ {
master->init_search(); join_key=master->join_key=join_key|master->join_key;
master->init_search(no_order);
ft_handler=master->ft_handler; ft_handler=master->ft_handler;
join_key=master->join_key; join_key=master->join_key;
return; return;
} }
if (join_key)
{
ft_handler=((FT_DOCLIST *)table->file->ft_handler);
return;
}
/* join won't use this ft-key, but we must to init it anyway */
String *ft_tmp=0; String *ft_tmp=0;
char tmp1[FT_QUERY_MAXLEN]; char tmp1[FT_QUERY_MAXLEN];
String tmp2(tmp1,sizeof(tmp1)); String tmp2(tmp1,sizeof(tmp1));
ft_tmp=key_item()->val_str(&tmp2); ft_tmp=key_item()->val_str(&tmp2);
ft_handler=(FT_DOCLIST *) ft_handler=(FT_DOCLIST *)
table->file->ft_init_ext(key, (byte*) ft_tmp->ptr(), ft_tmp->length()); table->file->ft_init_ext(key, (byte*) ft_tmp->ptr(), ft_tmp->length(),
join_key && !no_order);
if (join_key)
{
table->file->ft_handler=ft_handler;
return;
}
} }
bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist) bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist)
...@@ -1917,6 +1915,8 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist) ...@@ -1917,6 +1915,8 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist)
/* Why testing for const_item ? Monty */ /* Why testing for const_item ? Monty */
/* I'll remove it later, but this should include modifications to /* I'll remove it later, but this should include modifications to
find_best and auto_close as complement to auto_init code above. SerG */ find_best and auto_close as complement to auto_init code above. SerG */
/* I'd rather say now that const_item is assumed in quite a bit of
places, so it would be difficult to remove. SerG */
if (Item_func::fix_fields(thd,tlist) || !const_item()) if (Item_func::fix_fields(thd,tlist) || !const_item())
return 1; return 1;
...@@ -1996,7 +1996,6 @@ bool Item_func_match::fix_index() ...@@ -1996,7 +1996,6 @@ bool Item_func_match::fix_index()
} }
this->key=max_key; this->key=max_key;
first_call=1;
maybe_null=1; maybe_null=1;
join_key=0; join_key=0;
......
...@@ -838,7 +838,7 @@ public: ...@@ -838,7 +838,7 @@ public:
List<Item> fields; List<Item> fields;
TABLE *table; TABLE *table;
uint key; uint key;
bool first_call, join_key; bool join_key;
Item_func_match *master; Item_func_match *master;
FT_DOCLIST *ft_handler; FT_DOCLIST *ft_handler;
...@@ -863,5 +863,5 @@ public: ...@@ -863,5 +863,5 @@ public:
longlong val_int() { return val()!=0.0; } longlong val_int() { return val()!=0.0; }
bool fix_index(); bool fix_index();
void init_search(); void init_search(bool no_order);
}; };
...@@ -31,16 +31,7 @@ public: ...@@ -31,16 +31,7 @@ public:
FT_SELECT(TABLE *table, TABLE_REF *tref) : FT_SELECT(TABLE *table, TABLE_REF *tref) :
QUICK_SELECT (table,tref->key,1), ref(tref) {} QUICK_SELECT (table,tref->key,1), ref(tref) {}
int init() int init() { return error=file->ft_init(); }
{
#if 0
if (cp_buffer_from_ref(ref)) // as ft-key doesn't use store_key's
return -1;
#endif
return error=file->ft_init(ref->key,
ref->key_buff,
ref->key_length);
}
int get_next() { return error=file->ft_read(record); } int get_next() { return error=file->ft_read(record); }
}; };
......
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
double read_time; double read_time;
QUICK_SELECT(TABLE *table,uint index_arg,bool no_alloc=0); QUICK_SELECT(TABLE *table,uint index_arg,bool no_alloc=0);
virtual ~QUICK_SELECT(); // fixed by Sasha needs to be virtual virtual ~QUICK_SELECT();
void reset(void) { next=0; it.rewind(); } void reset(void) { next=0; it.rewind(); }
virtual int init() { return 0; } virtual int init() { return 0; }
virtual int get_next(); virtual int get_next();
......
...@@ -486,7 +486,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, ...@@ -486,7 +486,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
as in other cases the join is done before the sort. as in other cases the join is done before the sort.
*/ */
if ((order || group) && join.join_tab[join.const_tables].type != JT_ALL && if ((order || group) && join.join_tab[join.const_tables].type != JT_ALL &&
join.join_tab[join.const_tables].type != JT_FT && /* Beware! SerG */ join.join_tab[join.const_tables].type != JT_FT &&
(order && simple_order || group && simple_group)) (order && simple_order || group && simple_group))
{ {
if (add_ref_to_table_cond(thd,&join.join_tab[join.const_tables])) if (add_ref_to_table_cond(thd,&join.join_tab[join.const_tables]))
...@@ -522,6 +522,19 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, ...@@ -522,6 +522,19 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
goto err; goto err;
} }
/* 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";
while ((ifm=li++))
{
ifm->init_search(test(order));
}
}
/* Create a tmp table if distinct or if the sort is too complicated */ /* Create a tmp table if distinct or if the sort is too complicated */
if (need_tmp) if (need_tmp)
{ {
...@@ -4438,26 +4451,14 @@ join_ft_read_first(JOIN_TAB *tab) ...@@ -4438,26 +4451,14 @@ join_ft_read_first(JOIN_TAB *tab)
if (cp_buffer_from_ref(&tab->ref)) // as ft-key doesn't use store_key's if (cp_buffer_from_ref(&tab->ref)) // as ft-key doesn't use store_key's
return -1; // see also FT_SELECT::init() return -1; // see also FT_SELECT::init()
#endif #endif
if ((error=table->file->ft_init(tab->ref.key, table->file->ft_init();
tab->ref.key_buff,
tab->ref.key_length)))
{
if (error != HA_ERR_KEY_NOT_FOUND)
{
sql_print_error("ft_read_first/init: Got error %d when reading table %s",error,
table->path);
table->file->print_error(error,MYF(0));
return 1;
}
return -1;
}
error=table->file->ft_read(table->record[0]); error=table->file->ft_read(table->record[0]);
if (error) if (error)
{ {
if (error != HA_ERR_END_OF_FILE) if (error != HA_ERR_END_OF_FILE)
{ {
sql_print_error("ft_read_first/read: Got error %d when reading table %s", sql_print_error("ft_read_first: Got error %d when reading table %s",
error, table->path); error, table->path);
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment