mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
RB-Tree indexes support in HEAP tables
Renamed _hp_func -> hp_func mi_key_cmp moved to /mysys/my_handler.c New tests for HEAP tables
This commit is contained in:
@ -20,14 +20,39 @@
|
||||
|
||||
int heap_rfirst(HP_INFO *info, byte *record)
|
||||
{
|
||||
HP_SHARE *share = info->s;
|
||||
HP_KEYDEF *keyinfo = share->keydef + info->lastinx;
|
||||
|
||||
DBUG_ENTER("heap_rfirst");
|
||||
if (!(info->s->records))
|
||||
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
|
||||
{
|
||||
my_errno=HA_ERR_END_OF_FILE;
|
||||
DBUG_RETURN(my_errno);
|
||||
byte *pos;
|
||||
|
||||
if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents,
|
||||
&info->last_pos, offsetof(TREE_ELEMENT, left))))
|
||||
{
|
||||
memcpy(&pos, pos + keyinfo->ref_offs, sizeof(byte*));
|
||||
info->current_ptr = pos;
|
||||
memcpy(record, pos, (size_t)share->reclength);
|
||||
info->update = HA_STATE_AKTIV;
|
||||
}
|
||||
else
|
||||
{
|
||||
my_errno = HA_ERR_END_OF_FILE;
|
||||
DBUG_RETURN(my_errno);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(info->s->records))
|
||||
{
|
||||
my_errno=HA_ERR_END_OF_FILE;
|
||||
DBUG_RETURN(my_errno);
|
||||
}
|
||||
info->current_record=0;
|
||||
info->current_hash_ptr=0;
|
||||
info->update=HA_STATE_PREV_FOUND;
|
||||
DBUG_RETURN(heap_rnext(info,record));
|
||||
}
|
||||
info->current_record=0;
|
||||
info->current_hash_ptr=0;
|
||||
info->update=HA_STATE_PREV_FOUND;
|
||||
DBUG_RETURN(heap_rnext(info,record));
|
||||
}
|
||||
|
Reference in New Issue
Block a user