1 /* Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 /* Read through all rows sequntially */
24 
25 #include "myisamdef.h"
26 
mi_scan_init(MI_INFO * info)27 int mi_scan_init(MI_INFO *info)
28 {
29   DBUG_ENTER("mi_scan_init");
30   info->nextpos=info->s->pack.header_length;	/* Read first record */
31   info->lastinx= -1;				/* Can't forward or backward */
32   if (info->opt_flag & WRITE_CACHE_USED && flush_io_cache(&info->rec_cache))
33     DBUG_RETURN(my_errno());
34   DBUG_RETURN(0);
35 }
36 
37 /*
38 	   Read a row based on position.
39 	   If filepos= HA_OFFSET_ERROR then read next row
40 	   Return values
41 	   Returns one of following values:
42 	   0 = Ok.
43 	   HA_ERR_END_OF_FILE = EOF.
44 */
45 
mi_scan(MI_INFO * info,uchar * buf)46 int mi_scan(MI_INFO *info, uchar *buf)
47 {
48   int result;
49   DBUG_ENTER("mi_scan");
50   /* Init all but update-flag */
51   info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
52   result= (*info->s->read_rnd)(info, buf, info->nextpos, 1);
53   DBUG_RETURN(result);
54 }
55