diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2010-06-26 14:05:41 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2010-06-26 14:05:41 +0400 |
commit | 27f9fc063c54ad8c9c0e35e78bbbb14a3e2419af (patch) | |
tree | af692374b15c7e8186406a1009e678cfedc3e78b /storage/myisam/mi_rnext.c | |
parent | 7754be7f4c19d442564d8fef6853e711aa0e3cec (diff) | |
parent | 50cc6c9d8a7d68ace0802702f3bc10cb2afb3730 (diff) | |
download | mariadb-git-27f9fc063c54ad8c9c0e35e78bbbb14a3e2419af.tar.gz |
MariaDB 5.2 -> MariaDB 5.3 merge
Diffstat (limited to 'storage/myisam/mi_rnext.c')
-rw-r--r-- | storage/myisam/mi_rnext.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/storage/myisam/mi_rnext.c b/storage/myisam/mi_rnext.c index 584b7194ed1..b1c261dd6b1 100644 --- a/storage/myisam/mi_rnext.c +++ b/storage/myisam/mi_rnext.c @@ -29,6 +29,7 @@ int mi_rnext(MI_INFO *info, uchar *buf, int inx) int error,changed; uint flag; ICP_RESULT res= 0; + uint update_mask= HA_STATE_NEXT_FOUND; DBUG_ENTER("mi_rnext"); if ((inx = _mi_check_index(info,inx)) < 0) @@ -56,6 +57,20 @@ int mi_rnext(MI_INFO *info, uchar *buf, int inx) info->s->state.key_root[inx]); break; } + /* + "search first" failed. This means we have no pivot for + "search next", or in other words MI_INFO::lastkey is + likely uninitialized. + + Normally SQL layer would never request "search next" if + "search first" failed. But HANDLER may do anything. + + As mi_rnext() without preceeding mi_rkey()/mi_rfirst() + equals to mi_rfirst(), we must restore original state + as if failing mi_rfirst() was not called. + */ + if (error) + update_mask|= HA_STATE_PREV_FOUND; } else { @@ -114,7 +129,7 @@ int mi_rnext(MI_INFO *info, uchar *buf, int inx) /* Don't clear if database-changed */ info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); - info->update|= HA_STATE_NEXT_FOUND; + info->update|= update_mask; if (error) { |