00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "heap_priv.h"
00017
00018 #include <string.h>
00019
00020 using namespace drizzled;
00021
00022 int heap_rkey(HP_INFO *info, unsigned char *record, int inx, const unsigned char *key,
00023 key_part_map , enum ha_rkey_function )
00024 {
00025 unsigned char *pos;
00026 HP_SHARE *share= info->getShare();
00027 HP_KEYDEF *keyinfo= share->keydef + inx;
00028
00029 if ((uint) inx >= share->keys)
00030 {
00031 return(errno= HA_ERR_WRONG_INDEX);
00032 }
00033 info->lastinx= inx;
00034 info->current_record= UINT32_MAX;
00035 {
00036 if (!(pos= hp_search(info, share->keydef + inx, key, 0)))
00037 {
00038 info->update= 0;
00039 return(errno);
00040 }
00041 if (!(keyinfo->flag & HA_NOSAME))
00042 memcpy(&info->lastkey[0], key, (size_t) keyinfo->length);
00043 }
00044 hp_extract_record(share, record, pos);
00045 info->update= HA_STATE_AKTIV;
00046 return(0);
00047 }
00048
00049
00050
00051
00052 unsigned char* heap_find(HP_INFO *info, int inx, const unsigned char *key)
00053 {
00054 return hp_search(info, info->getShare()->keydef + inx, key, 0);
00055 }