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 #include <drizzled/error_t.h>
00020
00021 using namespace drizzled;
00022
00023 int heap_rkey(HP_INFO *info, unsigned char *record, int inx, const unsigned char *key,
00024 key_part_map , enum ha_rkey_function )
00025 {
00026 unsigned char *pos;
00027 HP_SHARE *share= info->getShare();
00028 HP_KEYDEF *keyinfo= share->keydef + inx;
00029
00030 if ((uint) inx >= share->keys)
00031 {
00032 return(errno= HA_ERR_WRONG_INDEX);
00033 }
00034 info->lastinx= inx;
00035 info->current_record= UINT32_MAX;
00036 {
00037 if (!(pos= hp_search(info, share->keydef + inx, key, 0)))
00038 {
00039 info->update= 0;
00040 return(errno);
00041 }
00042 if (!(keyinfo->flag & HA_NOSAME))
00043 memcpy(&info->lastkey[0], key, (size_t) keyinfo->length);
00044 }
00045 hp_extract_record(share, record, pos);
00046 info->update= HA_STATE_AKTIV;
00047 return(0);
00048 }
00049
00050
00051
00052
00053 unsigned char* heap_find(HP_INFO *info, int inx, const unsigned char *key)
00054 {
00055 return hp_search(info, info->getShare()->keydef + inx, key, 0);
00056 }