Example #1
0
int heap_rsame(register HP_INFO *info, uchar *record, int inx)
{
  HP_SHARE *share=info->s;
  DBUG_ENTER("heap_rsame");

  test_active(info);
  if (info->current_ptr[share->reclength])
  {
    if (inx < -1 || inx >= (int) share->keys)
    {
      DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX);
    }
    else if (inx != -1)
    {
      info->lastinx=inx;
      hp_make_key(share->keydef + inx, info->lastkey, record);
      if (!hp_search(info, share->keydef + inx, info->lastkey, 3))
      {
	info->update=0;
	DBUG_RETURN(my_errno);
      }
    }
    memcpy(record,info->current_ptr,(size_t) share->reclength);
    DBUG_RETURN(0);
  }
  info->update=0;

  DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
}
Example #2
0
int heap_rsame(register HP_INFO *info, uchar *record, int inx)
{
  HP_SHARE *share=info->s;
  DBUG_ENTER("heap_rsame");

  test_active(info);
  if (get_chunk_status(&share->recordspace, info->current_ptr) ==
      CHUNK_STATUS_ACTIVE)
  {
    if (inx < -1 || inx >= (int) share->keys)
    {
      DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX);
    }
    else if (inx != -1)
    {
      info->lastinx=inx;
      hp_make_key(share->keydef + inx, info->lastkey, record);
      if (!hp_search(info, share->keydef + inx, info->lastkey, 3))
      {
	info->update=0;
	DBUG_RETURN(my_errno);
      }
    }
    if (hp_extract_record(info, record, info->current_ptr))
    {
      DBUG_RETURN(my_errno);
    }
    DBUG_RETURN(0);
  }

  /* treat deleted and linked chunks as deleted */

  info->update=0;

  DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
}