summaryrefslogtreecommitdiff
path: root/storage/maria/ma_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/maria/ma_key.c')
-rw-r--r--storage/maria/ma_key.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c
index 0e1891fb249..f62ffcc49a0 100644
--- a/storage/maria/ma_key.c
+++ b/storage/maria/ma_key.c
@@ -644,8 +644,7 @@ int _ma_read_key_record(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos)
{ /* Read only key */
if (_ma_put_key_in_record(info, (uint)info->lastinx, TRUE, buf))
{
- maria_print_error(info->s, HA_ERR_CRASHED);
- my_errno=HA_ERR_CRASHED;
+ _ma_set_fatal_error(info->s, HA_ERR_CRASHED);
return -1;
}
info->update|= HA_STATE_AKTIV; /* We should find a record */
@@ -669,25 +668,39 @@ int _ma_read_key_record(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos)
will look for column values there)
RETURN
- ICP_ERROR Error
+ ICP_ERROR Error ; my_errno set to HA_ERR_CRASHED
ICP_NO_MATCH Index condition is not satisfied, continue scanning
ICP_MATCH Index condition is satisfied
- ICP_OUT_OF_RANGE Index condition is not satisfied, end the scan.
+ ICP_OUT_OF_RANGE Index condition is not satisfied, end the scan.
+ my_errno set to HA_ERR_END_OF_FILE
+
+ info->cur_row.lastpos is set to HA_OFFSET_ERROR in case of ICP_ERROR or
+ ICP_OUT_OF_RANGE to indicate that we don't have any active row.
*/
-int ma_check_index_cond(register MARIA_HA *info, uint keynr, uchar *record)
+ICP_RESULT ma_check_index_cond(register MARIA_HA *info, uint keynr,
+ uchar *record)
{
+ ICP_RESULT res= ICP_MATCH;
if (info->index_cond_func)
{
if (_ma_put_key_in_record(info, keynr, FALSE, record))
{
+ /* Impossible case; Can only happen if bug in code */
maria_print_error(info->s, HA_ERR_CRASHED);
- my_errno=HA_ERR_CRASHED;
- return -1;
+ info->cur_row.lastpos= HA_OFFSET_ERROR; /* No active record */
+ my_errno= HA_ERR_CRASHED;
+ res= ICP_ERROR;
+ }
+ else if ((res= info->index_cond_func(info->index_cond_func_arg)) ==
+ ICP_OUT_OF_RANGE)
+ {
+ /* We got beyond the end of scanned range */
+ info->cur_row.lastpos= HA_OFFSET_ERROR; /* No active record */
+ my_errno= HA_ERR_END_OF_FILE;
}
- return info->index_cond_func(info->index_cond_func_arg);
}
- return 1;
+ return res;
}