16
16
/* Remove a row from a MyISAM table */
18
#include "myisamdef.h"
20
20
static int d_search(MI_INFO *info,MI_KEYDEF *keyinfo,uint comp_flag,
21
21
uchar *key,uint key_length,my_off_t page,uchar *anc_buff);
75
75
if (mi_is_key_active(info->s->state.key_map, i))
77
77
info->s->keyinfo[i].version++;
78
if (info->s->keyinfo[i].flag & HA_FULLTEXT )
80
if (_mi_ft_del(info,i, old_key,record,info->lastpos))
85
79
if (info->s->keyinfo[i].ck_delete(info,i,old_key,
86
80
_mi_make_key(info,i,old_key,record,info->lastpos)))
170
if ((error=d_search(info,keyinfo,
171
(keyinfo->flag & HA_FULLTEXT ? SEARCH_FIND | SEARCH_UPDATE
173
key,key_length,old_root,root_buff)) >0)
164
if ((error=d_search(info,keyinfo, (SEARCH_SAME), key,key_length,old_root,root_buff)) > 0)
233
224
nod_flag=mi_test_if_nod(anc_buff);
235
if (!flag && keyinfo->flag & HA_FULLTEXT)
240
get_key_full_length_rdonly(off, lastkey);
241
subkeys=ft_sintXkorr(lastkey+off);
242
DBUG_ASSERT(info->ft1_to_ft2==0 || subkeys >=0);
243
comp_flag=SEARCH_SAME;
246
/* normal word, one-level tree structure */
247
if (info->ft1_to_ft2)
249
/* we're in ft1->ft2 conversion mode. Saving key data */
250
insert_dynamic(info->ft1_to_ft2, (lastkey+off));
254
/* we need exact match only if not in ft1->ft2 conversion mode */
255
flag=(*keyinfo->bin_search)(info,keyinfo,anc_buff,key,USE_WHOLE_KEY,
256
comp_flag, &keypos, lastkey, &last_key);
258
/* fall through to normal delete */
262
/* popular word. two-level tree. going down */
267
if (!(tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&kpos,lastkey)))
269
mi_print_error(info->s, HA_ERR_CRASHED);
270
my_errno= HA_ERR_CRASHED;
273
root=_mi_dpos(info,nod_flag,kpos);
276
/* the last entry in sub-tree */
277
if (_mi_dispose(info, keyinfo, root,DFLT_INIT_HITS))
279
/* fall through to normal delete */
283
keyinfo=&info->s->ft2_keyinfo;
284
kpos-=keyinfo->keylength+nod_flag; /* we'll modify key entry 'in vivo' */
285
get_key_full_length_rdonly(off, key);
287
ret_value=_mi_ck_real_delete(info, &info->s->ft2_keyinfo,
288
key, HA_FT_WLEN, &root);
289
_mi_dpointer(info, kpos+HA_FT_WLEN, root);
291
ft_intXstore(kpos, subkeys);
293
ret_value=_mi_write_keypage(info,keyinfo,page,
294
DFLT_INIT_HITS,anc_buff);
295
DBUG_PRINT("exit",("Return: %d",ret_value));
296
DBUG_RETURN(ret_value);