1/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 02111-1301 USA */
15
16/* Read a record with random-access. The position to the record must
17 get by MARIA_HA. The next record can be read with pos= MARIA_POS_ERROR */
18
19
20#include "maria_def.h"
21
22/*
23 Read a row based on position.
24
25 RETURN
26 0 Ok.
27 HA_ERR_RECORD_DELETED Record is deleted.
28 HA_ERR_END_OF_FILE EOF.
29*/
30
31int maria_rrnd(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos)
32{
33 int ret;
34 DBUG_ENTER("maria_rrnd");
35
36 DBUG_ASSERT(filepos != HA_OFFSET_ERROR);
37
38 /* Init all but update-flag */
39 info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
40 if (info->opt_flag & WRITE_CACHE_USED && flush_io_cache(&info->rec_cache))
41 DBUG_RETURN(my_errno);
42
43 info->cur_row.lastpos= filepos; /* Remember for update */
44 ret= (*info->s->read_record)(info, buf, filepos);
45 DBUG_RETURN(ret);
46}
47