~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_rsame.c

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include "myisamdef.h"
17
 
#include <drizzled/util/test.h>
18
 
 
19
17
 
20
18
        /*
21
19
        ** Find current row with read on position or read on key
27
25
        */
28
26
 
29
27
 
30
 
int mi_rsame(MI_INFO *info, unsigned char *record, int inx)
 
28
int mi_rsame(MI_INFO *info, uchar *record, int inx)
31
29
{
 
30
  DBUG_ENTER("mi_rsame");
 
31
 
32
32
  if (inx != -1 && ! mi_is_key_active(info->s->state.key_map, inx))
33
33
  {
34
 
    return(my_errno=HA_ERR_WRONG_INDEX);
 
34
    DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX);
35
35
  }
36
36
  if (info->lastpos == HA_OFFSET_ERROR || info->update & HA_STATE_DELETED)
37
37
  {
38
 
    return(my_errno=HA_ERR_KEY_NOT_FOUND);      /* No current record */
 
38
    DBUG_RETURN(my_errno=HA_ERR_KEY_NOT_FOUND); /* No current record */
39
39
  }
40
40
  info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
41
41
 
42
42
  /* Read row from data file */
43
43
  if (fast_mi_readinfo(info))
44
 
    return(my_errno);
 
44
    DBUG_RETURN(my_errno);
45
45
 
46
46
  if (inx >= 0)
47
47
  {
49
49
    info->lastkey_length=_mi_make_key(info,(uint) inx,info->lastkey,record,
50
50
                                      info->lastpos);
51
51
    if (info->s->concurrent_insert)
52
 
      pthread_rwlock_rdlock(&info->s->key_root_lock[inx]);
53
 
    _mi_search(info,info->s->keyinfo+inx,info->lastkey, USE_WHOLE_KEY,
54
 
               SEARCH_SAME,
55
 
               info->s->state.key_root[inx]);
 
52
      rw_rdlock(&info->s->key_root_lock[inx]);
 
53
    VOID(_mi_search(info,info->s->keyinfo+inx,info->lastkey, USE_WHOLE_KEY,
 
54
                    SEARCH_SAME,
 
55
                    info->s->state.key_root[inx]));
56
56
    if (info->s->concurrent_insert)
57
 
      pthread_rwlock_unlock(&info->s->key_root_lock[inx]);
 
57
      rw_unlock(&info->s->key_root_lock[inx]);
58
58
  }
59
59
 
60
60
  if (!(*info->read_record)(info,info->lastpos,record))
61
 
    return(0);
 
61
    DBUG_RETURN(0);
62
62
  if (my_errno == HA_ERR_RECORD_DELETED)
63
63
    my_errno=HA_ERR_KEY_NOT_FOUND;
64
 
  return(my_errno);
 
64
  DBUG_RETURN(my_errno);
65
65
} /* mi_rsame */