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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 :
31 : int maria_rrnd(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos)
32 3834 : {
33 3834 : DBUG_ENTER("maria_rrnd");
34 :
35 3834 : DBUG_ASSERT(filepos != HA_OFFSET_ERROR);
36 :
37 : /* Init all but update-flag */
38 3834 : info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
39 3834 : if (info->opt_flag & WRITE_CACHE_USED && flush_io_cache(&info->rec_cache))
40 0 : DBUG_RETURN(my_errno);
41 :
42 3834 : info->cur_row.lastpos= filepos; /* Remember for update */
43 3834 : DBUG_RETURN((*info->s->read_record)(info, buf, filepos));
44 : }
|