00001 /* Copyright (C) 2000-2001 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; version 2 of the License. 00006 00007 This program is distributed in the hope that it will be useful, 00008 but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 GNU General Public License for more details. 00011 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software 00014 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00015 00016 /* Read through all rows sequntially */ 00017 00018 #include "myisam_priv.h" 00019 00020 int mi_scan_init(register MI_INFO *info) 00021 { 00022 info->nextpos=info->s->pack.header_length; /* Read first record */ 00023 info->lastinx= -1; /* Can't forward or backward */ 00024 if (info->opt_flag & WRITE_CACHE_USED && flush_io_cache(&info->rec_cache)) 00025 return(errno); 00026 return(0); 00027 } 00028 00029 /* 00030 Read a row based on position. 00031 If filepos= HA_OFFSET_ERROR then read next row 00032 Return values 00033 Returns one of following values: 00034 0 = Ok. 00035 HA_ERR_END_OF_FILE = EOF. 00036 */ 00037 00038 int mi_scan(MI_INFO *info, unsigned char *buf) 00039 { 00040 /* Init all but update-flag */ 00041 info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); 00042 return((*info->s->read_rnd)(info,buf,info->nextpos,1)); 00043 }