~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/hp_rlast.cc

  • Committer: Brian Aker
  • Date: 2010-01-22 00:53:13 UTC
  • Revision ID: brian@gaz-20100122005313-jmizcbcdi1lt4tcx
Revert db patch.

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 "heapdef.h"
 
16
#include "heap_priv.h"
 
17
 
 
18
#include <string.h>
17
19
 
18
20
        /* Read first record with the current key */
19
21
 
20
22
 
21
 
int heap_rlast(HP_INFO *info, uchar *record, int inx)
 
23
int heap_rlast(HP_INFO *info, unsigned char *record, int inx)
22
24
{
23
25
  HP_SHARE *share=    info->s;
24
26
  HP_KEYDEF *keyinfo= share->keydef + inx;
26
28
  info->lastinx= inx;
27
29
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
28
30
  {
29
 
    uchar *pos;
 
31
    unsigned char *pos;
30
32
 
31
 
    if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents,
32
 
                                &info->last_pos, offsetof(TREE_ELEMENT, right))))
 
33
    if ((pos = (unsigned char *)tree_search_edge(&keyinfo->rb_tree,
 
34
                                                 info->parents,
 
35
                                                 &info->last_pos,
 
36
                                                 offsetof(TREE_ELEMENT, right))))
33
37
    {
34
 
      memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), 
35
 
             sizeof(uchar*));
 
38
      memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
 
39
             sizeof(unsigned char*));
36
40
      info->current_ptr = pos;
37
41
      hp_extract_record(share, record, pos);
38
42
      info->update = HA_STATE_AKTIV;
39
43
    }
40
44
    else
41
45
    {
42
 
      my_errno = HA_ERR_END_OF_FILE;
43
 
      return(my_errno);
 
46
      errno = HA_ERR_END_OF_FILE;
 
47
      return(errno);
44
48
    }
45
49
    return(0);
46
50
  }