~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/hp_rprev.cc

  • Committer: Monty Taylor
  • Date: 2010-08-12 20:27:32 UTC
  • mto: (1720.1.5 build)
  • mto: This revision was merged to the branch mainline in revision 1722.
  • Revision ID: mordred@inaugust.com-20100812202732-9kzchbkvkyki4n3u
Merged libdrizzle directly into tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include "heap_priv.h"
17
17
 
31
31
  if (info->lastinx < 0)
32
32
    return(errno=HA_ERR_WRONG_INDEX);
33
33
  keyinfo = share->keydef + info->lastinx;
 
34
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
 
35
  {
 
36
    heap_rb_param custom_arg;
 
37
 
 
38
    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));
 
43
    else
 
44
    {
 
45
      custom_arg.keyseg = keyinfo->seg;
 
46
      custom_arg.key_length = keyinfo->length;
 
47
      custom_arg.search_flag = SEARCH_SAME;
 
48
      pos = (unsigned char *)tree_search_key(&keyinfo->rb_tree,
 
49
                                             &info->lastkey[0], info->parents,
 
50
                                             &info->last_pos,
 
51
                                             info->last_find_flag,
 
52
                                             &custom_arg);
 
53
    }
 
54
    if (pos)
 
55
    {
 
56
      memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
 
57
             sizeof(unsigned char*));
 
58
      info->current_ptr = pos;
 
59
    }
 
60
    else
 
61
    {
 
62
      errno = HA_ERR_KEY_NOT_FOUND;
 
63
    }
 
64
  }
 
65
  else
34
66
  {
35
67
    if (info->current_ptr || (info->update & HA_STATE_NEXT_FOUND))
36
68
    {