~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/* Copyright (C) 2000-2001, 2005 MySQL AB
2
3
   This program is free software; you can redistribute it and/or modify
4
   it under the terms of the GNU General Public License as published by
5
   the Free Software Foundation; version 2 of the License.
6
7
   This program is distributed in the hope that it will be useful,
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
   GNU General Public License for more details.
11
12
   You should have received a copy of the GNU General Public License
13
   along with this program; if not, write to the Free Software
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
1 by brian
clean slate
15
1130.3.28 by Monty Taylor
Moved heapdef.h and myisamdef.h to *_priv.h for easier filtering for include guard check.
16
#include "myisam_priv.h"
492.1.7 by Monty Taylor
Moved test() to its own file.
17
#include <drizzled/util/test.h>
18
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
19
using namespace drizzled;
1 by brian
clean slate
20
21
	/*
22
	** Find current row with read on position or read on key
23
	** If inx >= 0 find record using key
24
	** Return values:
25
	** 0 = Ok.
26
	** HA_ERR_KEY_NOT_FOUND = Row is deleted
27
	** HA_ERR_END_OF_FILE   = End of file
28
	*/
29
30
481 by Brian Aker
Remove all of uchar.
31
int mi_rsame(MI_INFO *info, unsigned char *record, int inx)
1 by brian
clean slate
32
{
33
  if (inx != -1 && ! mi_is_key_active(info->s->state.key_map, inx))
34
  {
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
35
    return(errno=HA_ERR_WRONG_INDEX);
1 by brian
clean slate
36
  }
37
  if (info->lastpos == HA_OFFSET_ERROR || info->update & HA_STATE_DELETED)
38
  {
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
39
    return(errno=HA_ERR_KEY_NOT_FOUND);	/* No current record */
1 by brian
clean slate
40
  }
41
  info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
42
43
  /* Read row from data file */
44
  if (fast_mi_readinfo(info))
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
45
    return(errno);
1 by brian
clean slate
46
47
  if (inx >= 0)
48
  {
49
    info->lastinx=inx;
50
    info->lastkey_length=_mi_make_key(info,(uint) inx,info->lastkey,record,
51
				      info->lastpos);
398.1.10 by Monty Taylor
Actually removed VOID() this time.
52
    _mi_search(info,info->s->keyinfo+inx,info->lastkey, USE_WHOLE_KEY,
53
               SEARCH_SAME,
54
               info->s->state.key_root[inx]);
1 by brian
clean slate
55
  }
56
57
  if (!(*info->read_record)(info,info->lastpos,record))
51.1.109 by Jay Pipes
Removed/replaced DBUG
58
    return(0);
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
59
  if (errno == HA_ERR_RECORD_DELETED)
60
    errno=HA_ERR_KEY_NOT_FOUND;
61
  return(errno);
1 by brian
clean slate
62
} /* mi_rsame */