16
16
/* Remove a row from a MyISAM table */
18
#include "myisamdef.h"
21
20
static int d_search(MI_INFO *info,MI_KEYDEF *keyinfo,uint comp_flag,
22
21
uchar *key,uint key_length,my_off_t page,uchar *anc_buff);
76
75
if (mi_is_key_active(info->s->state.key_map, i))
78
77
info->s->keyinfo[i].version++;
79
if (info->s->keyinfo[i].flag & HA_FULLTEXT )
81
if (_mi_ft_del(info,i, old_key,record,info->lastpos))
86
79
if (info->s->keyinfo[i].ck_delete(info,i,old_key,
87
80
_mi_make_key(info,i,old_key,record,info->lastpos)))
171
if ((error=d_search(info,keyinfo,
172
(keyinfo->flag & HA_FULLTEXT ? SEARCH_FIND | SEARCH_UPDATE
174
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)
234
224
nod_flag=mi_test_if_nod(anc_buff);
236
if (!flag && keyinfo->flag & HA_FULLTEXT)
241
get_key_full_length_rdonly(off, lastkey);
242
subkeys=ft_sintXkorr(lastkey+off);
243
DBUG_ASSERT(info->ft1_to_ft2==0 || subkeys >=0);
244
comp_flag=SEARCH_SAME;
247
/* normal word, one-level tree structure */
248
if (info->ft1_to_ft2)
250
/* we're in ft1->ft2 conversion mode. Saving key data */
251
insert_dynamic(info->ft1_to_ft2, (lastkey+off));
255
/* we need exact match only if not in ft1->ft2 conversion mode */
256
flag=(*keyinfo->bin_search)(info,keyinfo,anc_buff,key,USE_WHOLE_KEY,
257
comp_flag, &keypos, lastkey, &last_key);
259
/* fall through to normal delete */
263
/* popular word. two-level tree. going down */
268
if (!(tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&kpos,lastkey)))
270
mi_print_error(info->s, HA_ERR_CRASHED);
271
my_errno= HA_ERR_CRASHED;
274
root=_mi_dpos(info,nod_flag,kpos);
277
/* the last entry in sub-tree */
278
if (_mi_dispose(info, keyinfo, root,DFLT_INIT_HITS))
280
/* fall through to normal delete */
284
keyinfo=&info->s->ft2_keyinfo;
285
kpos-=keyinfo->keylength+nod_flag; /* we'll modify key entry 'in vivo' */
286
get_key_full_length_rdonly(off, key);
288
ret_value=_mi_ck_real_delete(info, &info->s->ft2_keyinfo,
289
key, HA_FT_WLEN, &root);
290
_mi_dpointer(info, kpos+HA_FT_WLEN, root);
292
ft_intXstore(kpos, subkeys);
294
ret_value=_mi_write_keypage(info,keyinfo,page,
295
DFLT_INIT_HITS,anc_buff);
296
DBUG_PRINT("exit",("Return: %d",ret_value));
297
DBUG_RETURN(ret_value);