Commit 06cba627 authored by istruewing@chilla.local's avatar istruewing@chilla.local

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-engines

into  chilla.local:/home/mydev/mysql-5.1-axmrg
parents 9d965f8a 5d71c2f8
...@@ -1489,6 +1489,25 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base) ...@@ -1489,6 +1489,25 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
return new Item_int(value,1); return new Item_int(value,1);
} }
case SHOW_CHAR_PTR:
{
Item *tmp;
pthread_mutex_lock(&LOCK_global_system_variables);
char *str= *(char**) value_ptr(thd, var_type, base);
if (str)
{
uint length= strlen(str);
tmp= new Item_string(thd->strmake(str, length), length,
system_charset_info, DERIVATION_SYSCONST);
}
else
{
tmp= new Item_null();
tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
}
pthread_mutex_unlock(&LOCK_global_system_variables);
return tmp;
}
case SHOW_CHAR: case SHOW_CHAR:
{ {
Item *tmp; Item *tmp;
......
...@@ -286,7 +286,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param, ...@@ -286,7 +286,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
} }
static void _ftb_parse_query(FTB *ftb, byte *query, uint len, static int _ftb_parse_query(FTB *ftb, byte *query, uint len,
struct st_mysql_ftparser *parser) struct st_mysql_ftparser *parser)
{ {
MYSQL_FTPARSER_PARAM *param; MYSQL_FTPARSER_PARAM *param;
...@@ -295,9 +295,9 @@ static void _ftb_parse_query(FTB *ftb, byte *query, uint len, ...@@ -295,9 +295,9 @@ static void _ftb_parse_query(FTB *ftb, byte *query, uint len,
DBUG_ASSERT(parser); DBUG_ASSERT(parser);
if (ftb->state != UNINITIALIZED) if (ftb->state != UNINITIALIZED)
DBUG_VOID_RETURN; DBUG_RETURN(0);
if (! (param= ftparser_call_initializer(ftb->info, ftb->keynr, 0))) if (! (param= ftparser_call_initializer(ftb->info, ftb->keynr, 0)))
DBUG_VOID_RETURN; DBUG_RETURN(1);
ftb_param.ftb= ftb; ftb_param.ftb= ftb;
ftb_param.depth= 0; ftb_param.depth= 0;
...@@ -312,8 +312,7 @@ static void _ftb_parse_query(FTB *ftb, byte *query, uint len, ...@@ -312,8 +312,7 @@ static void _ftb_parse_query(FTB *ftb, byte *query, uint len,
param->length= len; param->length= len;
param->flags= 0; param->flags= 0;
param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO; param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
parser->parse(param); DBUG_RETURN(parser->parse(param));
DBUG_VOID_RETURN;
} }
...@@ -538,9 +537,10 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, ...@@ -538,9 +537,10 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
ftbe->phrase= NULL; ftbe->phrase= NULL;
ftbe->document= 0; ftbe->document= 0;
ftb->root=ftbe; ftb->root=ftbe;
_ftb_parse_query(ftb, query, query_len, keynr == NO_SUCH_KEY ? if (unlikely(_ftb_parse_query(ftb, query, query_len,
&ft_default_parser : keynr == NO_SUCH_KEY ? &ft_default_parser :
info->s->keyinfo[keynr].parser); info->s->keyinfo[keynr].parser)))
goto err;
/* /*
Hack: instead of init_queue, we'll use reinit queue to be able Hack: instead of init_queue, we'll use reinit queue to be able
to alloc queue with alloc_root() to alloc queue with alloc_root()
...@@ -621,7 +621,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param, ...@@ -621,7 +621,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
{ {
param->mysql_add_word(param, word.pos, word.len, 0); param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match) if (phrase_param->match)
return 1; break;
} }
return 0; return 0;
} }
...@@ -639,6 +639,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param, ...@@ -639,6 +639,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
RETURN VALUE RETURN VALUE
1 is returned if phrase found, 0 else. 1 is returned if phrase found, 0 else.
-1 is returned if error occurs.
*/ */
static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len, static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len,
...@@ -667,12 +668,13 @@ static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len, ...@@ -667,12 +668,13 @@ static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len,
param->length= len; param->length= len;
param->flags= 0; param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS; param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
parser->parse(param); if (unlikely(parser->parse(param)))
return -1;
DBUG_RETURN(ftb_param.match ? 1 : 0); DBUG_RETURN(ftb_param.match ? 1 : 0);
} }
static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_orig) static int _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_orig)
{ {
FT_SEG_ITERATOR ftsi; FT_SEG_ITERATOR ftsi;
FTB_EXPR *ftbe; FTB_EXPR *ftbe;
...@@ -704,17 +706,19 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_ ...@@ -704,17 +706,19 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
weight=ftbe->cur_weight*ftbe->weight; weight=ftbe->cur_weight*ftbe->weight;
if (mode && ftbe->phrase) if (mode && ftbe->phrase)
{ {
int not_found=1; int found= 0;
memcpy(&ftsi, ftsi_orig, sizeof(ftsi)); memcpy(&ftsi, ftsi_orig, sizeof(ftsi));
while (_mi_ft_segiterator(&ftsi) && not_found) while (_mi_ft_segiterator(&ftsi) && !found)
{ {
if (!ftsi.pos) if (!ftsi.pos)
continue; continue;
not_found = ! _ftb_check_phrase(ftb, ftsi.pos, ftsi.len, found= _ftb_check_phrase(ftb, ftsi.pos, ftsi.len, ftbe, parser);
ftbe, parser); if (unlikely(found < 0))
return 1;
} }
if (not_found) break; if (!found)
break;
} /* ftbe->quot */ } /* ftbe->quot */
} }
else else
...@@ -746,6 +750,7 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_ ...@@ -746,6 +750,7 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
weight*= ftbe->weight; weight*= ftbe->weight;
} }
} }
return 0;
} }
...@@ -778,7 +783,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) ...@@ -778,7 +783,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
{ {
while (curdoc == (ftbw=(FTB_WORD *)queue_top(& ftb->queue))->docid[0]) while (curdoc == (ftbw=(FTB_WORD *)queue_top(& ftb->queue))->docid[0])
{ {
_ftb_climb_the_tree(ftb, ftbw, 0); if (unlikely(_ftb_climb_the_tree(ftb, ftbw, 0)))
{
my_errno= HA_ERR_OUT_OF_MEM;
goto err;
}
/* update queue */ /* update queue */
_ft2_search(ftb, ftbw, 0); _ft2_search(ftb, ftbw, 0);
...@@ -854,7 +863,8 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param, ...@@ -854,7 +863,8 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
if (ftbw->docid[1] == ftb->info->lastpos) if (ftbw->docid[1] == ftb->info->lastpos)
continue; continue;
ftbw->docid[1]= ftb->info->lastpos; ftbw->docid[1]= ftb->info->lastpos;
_ftb_climb_the_tree(ftb, ftbw, ftb_param->ftsi); if (unlikely(_ftb_climb_the_tree(ftb, ftbw, ftb_param->ftsi)))
return 1;
} }
return(0); return(0);
} }
...@@ -926,7 +936,8 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) ...@@ -926,7 +936,8 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
continue; continue;
param->doc= (byte *)ftsi.pos; param->doc= (byte *)ftsi.pos;
param->length= ftsi.len; param->length= ftsi.len;
parser->parse(param); if (unlikely(parser->parse(param)))
return 0;
} }
ftbe=ftb->root; ftbe=ftb->root;
if (ftbe->docid[1]==docid && ftbe->cur_weight>0 && if (ftbe->docid[1]==docid && ftbe->cur_weight>0 &&
......
...@@ -257,8 +257,12 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, ...@@ -257,8 +257,12 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
{ {
info->update|= HA_STATE_AKTIV; info->update|= HA_STATE_AKTIV;
ftparser_param->flags= MYSQL_FTFLAGS_NEED_COPY; ftparser_param->flags= MYSQL_FTFLAGS_NEED_COPY;
_mi_ft_parse(&wtree, info, keynr, record, ftparser_param, if (unlikely(_mi_ft_parse(&wtree, info, keynr, record, ftparser_param,
&wtree.mem_root); &wtree.mem_root)))
{
delete_queue(&best);
goto err;
}
} }
} }
delete_queue(&best); delete_queue(&best);
......
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