~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to storage/myisammrg/myrg_rlast.c

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000-2001, 2003 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA */
 
15
 
 
16
#include "myrg_def.h"
 
17
 
 
18
        /* Read last row with the same key as the previous read. */
 
19
 
 
20
int myrg_rlast(MYRG_INFO *info, uchar *buf, int inx)
 
21
{
 
22
  MYRG_TABLE *table;
 
23
  MI_INFO *mi;
 
24
  int err;
 
25
 
 
26
  if (_myrg_init_queue(info,inx, HA_READ_KEY_OR_PREV))
 
27
    return my_errno;
 
28
 
 
29
  for (table=info->open_tables ; table < info->end_table ; table++)
 
30
  {
 
31
    if ((err=mi_rlast(table->table,NULL,inx)))
 
32
    {
 
33
      if (err == HA_ERR_END_OF_FILE)
 
34
        continue;
 
35
      return err;
 
36
    }
 
37
    /* adding to queue */
 
38
    queue_insert(&(info->by_key),(uchar *)table);
 
39
  }
 
40
  /* We have done a read in all tables */
 
41
  info->last_used_table=table;
 
42
 
 
43
  if (!info->by_key.elements)
 
44
    return HA_ERR_END_OF_FILE;
 
45
 
 
46
  mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
 
47
  return _myrg_mi_read_record(mi,buf);
 
48
}
 
49