16 #include "myisamdef.h"
18 #ifdef HAVE_RTREE_KEYS
33 uint key_length, uchar *page_buf, my_off_t *new_page)
35 uint page_size = mi_getint(page_buf);
36 uint nod_flag = mi_test_if_nod(page_buf);
37 DBUG_ENTER(
"rtree_add_key");
39 if (page_size + key_length + info->s->base.rec_reflength <=
40 keyinfo->block_length)
46 DBUG_ASSERT(_mi_kpos(nod_flag, key) < info->state->key_file_length);
47 memcpy(rt_PAGE_END(page_buf), key - nod_flag, key_length + nod_flag);
48 page_size += key_length + nod_flag;
53 DBUG_ASSERT(_mi_dpos(info, nod_flag, key + key_length +
54 info->s->base.rec_reflength) <
55 info->state->data_file_length + info->s->base.pack_reclength);
56 memcpy(rt_PAGE_END(page_buf), key, key_length +
57 info->s->base.rec_reflength);
58 page_size += key_length + info->s->base.rec_reflength;
60 mi_putint(page_buf, page_size, nod_flag);
64 DBUG_RETURN((rtree_split_page(info, keyinfo, page_buf, key, key_length,
71 int rtree_delete_key(
MI_INFO *info, uchar *page_buf, uchar *key,
72 uint key_length, uint nod_flag)
74 uint16 page_size = mi_getint(page_buf);
77 key_start= key - nod_flag;
79 key_length += info->s->base.rec_reflength;
81 memmove(key_start, key + key_length, page_size - key_length -
83 page_size-= key_length + nod_flag;
85 mi_putint(page_buf, page_size, nod_flag);
95 uint key_length, my_off_t child_page)
97 DBUG_ENTER(
"rtree_set_key_mbr");
99 if (!_mi_fetch_keypage(info, keyinfo, child_page,
100 DFLT_INIT_HITS, info->buff, 0))
103 DBUG_RETURN(rtree_page_mbr(info, keyinfo->seg, info->buff, key, key_length));