~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_rkey.c

  • Committer: Brian Aker
  • Date: 2009-01-24 09:43:35 UTC
  • Revision ID: brian@gir-3.local-20090124094335-6qdtvc35gl5fvivz
Adding in an example singe thread scheduler

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 "heap_priv.h"
 
16
#include "heapdef.h"
17
17
 
18
18
#include <string.h>
19
19
 
20
 
using namespace drizzled;
21
 
 
22
20
int heap_rkey(HP_INFO *info, unsigned char *record, int inx, const unsigned char *key,
23
21
              key_part_map keypart_map, enum ha_rkey_function find_flag)
24
22
{
28
26
 
29
27
  if ((uint) inx >= share->keys)
30
28
  {
31
 
    return(errno= HA_ERR_WRONG_INDEX);
 
29
    return(my_errno= HA_ERR_WRONG_INDEX);
32
30
  }
33
31
  info->lastinx= inx;
34
32
  info->current_record= UINT32_MAX;             /* For heap_rrnd() */
49
47
      info->last_find_flag= HA_READ_KEY_OR_PREV;
50
48
    else
51
49
      info->last_find_flag= find_flag;
52
 
    if (!(pos= (unsigned char *)tree_search_key(&keyinfo->rb_tree,
53
 
                                                info->lastkey, info->parents,
54
 
                                                &info->last_pos,
55
 
                                                find_flag, &custom_arg)))
 
50
    if (!(pos= tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
 
51
                               &info->last_pos, find_flag, &custom_arg)))
56
52
    {
57
53
      info->update= 0;
58
 
      return(errno= HA_ERR_KEY_NOT_FOUND);
 
54
      return(my_errno= HA_ERR_KEY_NOT_FOUND);
59
55
    }
60
56
    memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(unsigned char*));
61
57
    info->current_ptr= pos;
65
61
    if (!(pos= hp_search(info, share->keydef + inx, key, 0)))
66
62
    {
67
63
      info->update= 0;
68
 
      return(errno);
 
64
      return(my_errno);
69
65
    }
70
66
    if (!(keyinfo->flag & HA_NOSAME))
71
67
      memcpy(info->lastkey, key, (size_t) keyinfo->length);