12
12
You should have received a copy of the GNU General Public License
13
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 */
16
#include "myisamdef.h"
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
#include "myisam_priv.h"
18
using namespace drizzled;
19
21
Read next row with the same key as previous read, but abort if
30
32
MI_KEYDEF *keyinfo;
32
34
if ((int) (inx=info->lastinx) < 0 || info->lastpos == HA_OFFSET_ERROR)
33
return(my_errno=HA_ERR_WRONG_INDEX);
35
return(errno=HA_ERR_WRONG_INDEX);
34
36
keyinfo=info->s->keyinfo+inx;
35
37
if (fast_mi_readinfo(info))
38
if (info->s->concurrent_insert)
39
rw_rdlock(&info->s->key_root_lock[inx]);
41
40
switch (keyinfo->key_alg)
57
56
info->last_rkey_length, SEARCH_FIND, not_used))
60
my_errno=HA_ERR_END_OF_FILE;
59
errno=HA_ERR_END_OF_FILE;
61
60
info->lastpos= HA_OFFSET_ERROR;
64
63
/* Skip rows that are inserted by other threads since we got a lock */
65
if (info->lastpos < info->state->data_file_length &&
64
if (info->lastpos < info->state->data_file_length &&
66
65
(!info->index_cond_func || mi_check_index_cond(info, inx, buf)))
70
if (info->s->concurrent_insert)
71
rw_unlock(&info->s->key_root_lock[inx]);
72
/* Don't clear if database-changed */
69
/* Don't clear if database-changed */
73
70
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
74
71
info->update|= HA_STATE_NEXT_FOUND | HA_STATE_RNEXT_SAME;
78
if (my_errno == HA_ERR_KEY_NOT_FOUND)
79
my_errno=HA_ERR_END_OF_FILE;
75
if (errno == HA_ERR_KEY_NOT_FOUND)
76
errno=HA_ERR_END_OF_FILE;
83
return(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0);
80
return(info->lastpos==HA_OFFSET_ERROR ? errno : 0);
85
82
else if (!(*info->read_record)(info,info->lastpos,buf))
87
84
info->update|= HA_STATE_AKTIV; /* Record is read */
91
88
} /* mi_rnext_same */