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 through all rows sequntially */
17 :
18 : #include "maria_def.h"
19 :
20 : int maria_scan_init(register MARIA_HA *info)
21 1057 : {
22 1057 : DBUG_ENTER("maria_scan_init");
23 :
24 1057 : info->cur_row.nextpos= info->s->pack.header_length; /* Read first record */
25 1057 : info->lastinx= -1; /* Can't forward or backward */
26 1057 : if (info->opt_flag & WRITE_CACHE_USED && flush_io_cache(&info->rec_cache))
27 0 : DBUG_RETURN(my_errno);
28 :
29 1057 : if ((*info->s->scan_init)(info))
30 0 : DBUG_RETURN(my_errno);
31 1057 : DBUG_RETURN(0);
32 : }
33 :
34 : /*
35 : Read a row based on position.
36 :
37 : SYNOPSIS
38 : maria_scan()
39 : info Maria handler
40 : record Read data here
41 :
42 : RETURN
43 : 0 ok
44 : HA_ERR_END_OF_FILE End of file
45 : HA_ERR_RECORD_DELETED Record was deleted (can only happen for static rec)
46 : # Error code
47 : */
48 :
49 : int maria_scan(MARIA_HA *info, uchar *record)
50 528590 : {
51 528590 : DBUG_ENTER("maria_scan");
52 : /* Init all but update-flag */
53 528590 : info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
54 528590 : DBUG_RETURN((*info->s->scan)(info, record, info->cur_row.nextpos, 1));
55 : }
56 :
57 :
58 : void maria_scan_end(MARIA_HA *info)
59 1225 : {
60 1225 : (*info->s->scan_end)(info);
61 : }
62 :
63 :
64 : int _ma_def_scan_remember_pos(MARIA_HA *info, MARIA_RECORD_POS *lastpos)
65 0 : {
66 0 : *lastpos= info->cur_row.lastpos;
67 0 : return 0;
68 : }
69 :
70 :
71 : void _ma_def_scan_restore_pos(MARIA_HA *info, MARIA_RECORD_POS lastpos)
72 0 : {
73 0 : info->cur_row.nextpos= lastpos;
74 : }
|