~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/hp_rlast.cc

  • Committer: Brian Aker
  • Date: 2010-07-30 20:31:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1679.
  • Revision ID: brian@gaz-20100730203119-89g2ye4zwnvcacxg
First pass in encapsulating row

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