~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_rsame.c

  • Committer: Stewart Smith
  • Date: 2008-07-13 06:56:15 UTC
  • mto: (210.1.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 211.
  • Revision ID: stewart@flamingspork.com-20080713065615-vzok75kgnnviokl9
Move MD5() into a UDF

Show diffs side-by-side

added added

removed removed

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