~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_rprev.c

  • Committer: Monty Taylor
  • Date: 2008-12-11 02:44:41 UTC
  • mto: This revision was merged to the branch mainline in revision 672.
  • Revision ID: monty@inaugust.com-20081211024441-5dsauvxl7mo7r1hb
Fix for the weird solaris gettext bug.

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
        /* Read prev record for key */
23
21
 
24
22
 
29
27
  HP_KEYDEF *keyinfo;
30
28
 
31
29
  if (info->lastinx < 0)
32
 
    return(errno=HA_ERR_WRONG_INDEX);
 
30
    return(my_errno=HA_ERR_WRONG_INDEX);
33
31
  keyinfo = share->keydef + info->lastinx;
34
32
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
35
33
  {
36
34
    heap_rb_param custom_arg;
37
35
 
38
36
    if (info->last_pos)
39
 
      pos = (unsigned char *)tree_search_next(&keyinfo->rb_tree,
40
 
                                              &info->last_pos,
41
 
                                              offsetof(TREE_ELEMENT, right),
42
 
                                              offsetof(TREE_ELEMENT, left));
 
37
      pos = tree_search_next(&keyinfo->rb_tree, &info->last_pos,
 
38
                             offsetof(TREE_ELEMENT, right),
 
39
                             offsetof(TREE_ELEMENT, left));
43
40
    else
44
41
    {
45
42
      custom_arg.keyseg = keyinfo->seg;
46
43
      custom_arg.key_length = keyinfo->length;
47
44
      custom_arg.search_flag = SEARCH_SAME;
48
 
      pos = (unsigned char *)tree_search_key(&keyinfo->rb_tree,
49
 
                                             info->lastkey, info->parents,
50
 
                                             &info->last_pos,
51
 
                                             info->last_find_flag,
52
 
                                             &custom_arg);
 
45
      pos = tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
 
46
                           &info->last_pos, info->last_find_flag, &custom_arg);
53
47
    }
54
48
    if (pos)
55
49
    {
59
53
    }
60
54
    else
61
55
    {
62
 
      errno = HA_ERR_KEY_NOT_FOUND;
 
56
      my_errno = HA_ERR_KEY_NOT_FOUND;
63
57
    }
64
58
  }
65
59
  else
74
68
    else
75
69
    {
76
70
      pos=0;                                    /* Read next after last */
77
 
      errno=HA_ERR_KEY_NOT_FOUND;
 
71
      my_errno=HA_ERR_KEY_NOT_FOUND;
78
72
    }
79
73
  }
80
74
  if (!pos)
81
75
  {
82
76
    info->update=HA_STATE_PREV_FOUND;           /* For heap_rprev */
83
 
    if (errno == HA_ERR_KEY_NOT_FOUND)
84
 
      errno=HA_ERR_END_OF_FILE;
85
 
    return(errno);
 
77
    if (my_errno == HA_ERR_KEY_NOT_FOUND)
 
78
      my_errno=HA_ERR_END_OF_FILE;
 
79
    return(my_errno);
86
80
  }
87
81
  hp_extract_record(share, record, pos);
88
82
  info->update=HA_STATE_AKTIV | HA_STATE_PREV_FOUND;