18 #include "heap_priv.h"
19 #include <drizzled/error_t.h>
23 int heap_update(
HP_INFO *info,
const unsigned char *old_record,
const unsigned char *new_record)
27 bool auto_key_changed= 0;
31 pos=info->current_ptr;
33 if (info->opt_flag & READ_CHECK_USED && hp_rectest(info,old_record))
36 if (--(share->records) < share->blength >> 1) share->blength>>= 1;
39 p_lastinx= share->keydef + info->lastinx;
40 for (keydef= share->keydef, end= keydef + share->keys; keydef < end; keydef++)
42 if (hp_rec_key_cmp(keydef, old_record, new_record, 0))
44 if (hp_delete_key(info, keydef, old_record, pos, keydef == p_lastinx) ||
45 hp_write_key(info, keydef, new_record, pos))
49 if (share->auto_key == (uint) (keydef - share->keydef + 1))
53 hp_copy_record_data_to_chunkset(share, new_record, pos);
54 if (++(share->records) == share->blength) share->blength+= share->blength;
57 heap_update_auto_increment(info, new_record);
61 if (errno == HA_ERR_FOUND_DUPP_KEY)
63 info->errkey = (int) (keydef - share->keydef);
64 while (keydef >= share->keydef)
66 if (hp_rec_key_cmp(keydef, old_record, new_record, 0))
68 if (hp_delete_key(info, keydef, new_record, pos, 0) ||
69 hp_write_key(info, keydef, old_record, pos))
76 if (++(share->records) == share->blength)
77 share->blength+= share->blength;
TODO: Rename this file - func.h is stupid.