mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 15:15:34 +02:00
(UPDATE|DELETE) ...WHERE MATCH bugfix
This commit is contained in:
parent
680d021907
commit
dfbeb93550
4 changed files with 20 additions and 12 deletions
|
|
@ -6,6 +6,10 @@ Full-text indexes are called collections
|
||||||
a b
|
a b
|
||||||
Full-text indexes are called collections
|
Full-text indexes are called collections
|
||||||
Only MyISAM tables support collections
|
Only MyISAM tables support collections
|
||||||
|
a b
|
||||||
|
Only MyISAM tables support collections
|
||||||
|
Function MATCH ... AGAINST() is used to do a search
|
||||||
|
some test foobar implements vector space model
|
||||||
id
|
id
|
||||||
id
|
id
|
||||||
id
|
id
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||||
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||||
select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
|
select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
|
||||||
delete from t1 where a like "MySQL%";
|
delete from t1 where a like "MySQL%";
|
||||||
|
update t1 set a='some test foobar' where MATCH a,b AGAINST ('model');
|
||||||
|
delete from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||||
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
@ -51,8 +51,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table)
|
||||||
pthread_mutex_unlock(&LOCK_open);
|
pthread_mutex_unlock(&LOCK_open);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If it is a temporary table, close and regenerate it */
|
||||||
/* If it is a temporary table, close and regenerate it */
|
|
||||||
if ((table_ptr=find_temporary_table(thd,table_list->db,
|
if ((table_ptr=find_temporary_table(thd,table_list->db,
|
||||||
table_list->real_name)))
|
table_list->real_name)))
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +125,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
|
||||||
TABLE *table;
|
TABLE *table;
|
||||||
SQL_SELECT *select;
|
SQL_SELECT *select;
|
||||||
READ_RECORD info;
|
READ_RECORD info;
|
||||||
bool using_limit=limit != HA_POS_ERROR;
|
bool using_limit=limit != HA_POS_ERROR;
|
||||||
bool use_generate_table,using_transactions;
|
bool use_generate_table,using_transactions;
|
||||||
DBUG_ENTER("mysql_delete");
|
DBUG_ENTER("mysql_delete");
|
||||||
|
|
||||||
|
|
@ -163,7 +162,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
|
||||||
if (use_generate_table)
|
if (use_generate_table)
|
||||||
DBUG_RETURN(generate_table(thd,table_list,table));
|
DBUG_RETURN(generate_table(thd,table_list,table));
|
||||||
table->map=1;
|
table->map=1;
|
||||||
if (setup_conds(thd,table_list,&conds))
|
if (setup_conds(thd,table_list,&conds) || setup_ftfuncs(thd))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
table->used_keys=table->quick_keys=0; // Can't use 'only index'
|
table->used_keys=table->quick_keys=0; // Can't use 'only index'
|
||||||
|
|
@ -171,7 +170,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
|
||||||
if (error)
|
if (error)
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
if ((select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES),
|
if ((select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES),
|
||||||
limit)) ||
|
limit)) ||
|
||||||
!limit)
|
!limit)
|
||||||
{
|
{
|
||||||
delete select;
|
delete select;
|
||||||
|
|
@ -192,9 +191,10 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
|
||||||
}
|
}
|
||||||
(void) table->file->extra(HA_EXTRA_NO_READCHECK);
|
(void) table->file->extra(HA_EXTRA_NO_READCHECK);
|
||||||
if (options & OPTION_QUICK)
|
if (options & OPTION_QUICK)
|
||||||
(void) table->file->extra(HA_EXTRA_QUICK);
|
(void) table->file->extra(HA_EXTRA_QUICK);
|
||||||
init_read_record(&info,thd,table,select,-1,1);
|
init_read_record(&info,thd,table,select,-1,1);
|
||||||
ulong deleted=0L;
|
ulong deleted=0L;
|
||||||
|
init_ftfuncs(thd,1);
|
||||||
thd->proc_info="updating";
|
thd->proc_info="updating";
|
||||||
while (!(error=info.read_record(&info)) && !thd->killed)
|
while (!(error=info.read_record(&info)) && !thd->killed)
|
||||||
{
|
{
|
||||||
|
|
@ -223,7 +223,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
|
||||||
end_read_record(&info);
|
end_read_record(&info);
|
||||||
(void) table->file->extra(HA_EXTRA_READCHECK);
|
(void) table->file->extra(HA_EXTRA_READCHECK);
|
||||||
if (options & OPTION_QUICK)
|
if (options & OPTION_QUICK)
|
||||||
(void) table->file->extra(HA_EXTRA_NORMAL);
|
(void) table->file->extra(HA_EXTRA_NORMAL);
|
||||||
using_transactions=table->file->has_transactions();
|
using_transactions=table->file->has_transactions();
|
||||||
if (deleted && (error <= 0 || !using_transactions))
|
if (deleted && (error <= 0 || !using_transactions))
|
||||||
{
|
{
|
||||||
|
|
@ -255,4 +255,3 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
|
||||||
table->quick_keys=0;
|
table->quick_keys=0;
|
||||||
want_privilege=table->grant.want_privilege;
|
want_privilege=table->grant.want_privilege;
|
||||||
table->grant.want_privilege=(SELECT_ACL & ~table->grant.privilege);
|
table->grant.want_privilege=(SELECT_ACL & ~table->grant.privilege);
|
||||||
if (setup_tables(table_list) || setup_conds(thd,table_list,&conds))
|
if (setup_tables(table_list) || setup_conds(thd,table_list,&conds)
|
||||||
|
|| setup_ftfuncs(thd))
|
||||||
DBUG_RETURN(-1); /* purecov: inspected */
|
DBUG_RETURN(-1); /* purecov: inspected */
|
||||||
old_used_keys=table->used_keys; // Keys used in WHERE
|
old_used_keys=table->used_keys; // Keys used in WHERE
|
||||||
|
|
||||||
|
|
@ -134,6 +135,7 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
init_ftfuncs(thd,1);
|
||||||
/* Check if we are modifying a key that we are used to search with */
|
/* Check if we are modifying a key that we are used to search with */
|
||||||
if (select && select->quick)
|
if (select && select->quick)
|
||||||
used_key_is_modified= (!select->quick->unique_key_range() &&
|
used_key_is_modified= (!select->quick->unique_key_range() &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue