~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/hp_rlast.cc

  • Committer: Brian Aker
  • Date: 2009-11-24 02:06:37 UTC
  • mfrom: (1223.1.7 push)
  • Revision ID: brian@gaz-20091124020637-9gb65vj98x1arydm
Merge for staging.

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