summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_search.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/myisam/mi_search.c')
-rw-r--r--storage/myisam/mi_search.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index a7836280a2b..f03311e6ce4 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -28,9 +28,15 @@ int _mi_check_index(MI_INFO *info, int inx)
{
if (inx == -1) /* Use last index */
inx=info->lastinx;
- if (inx < 0 || ! mi_is_key_active(info->s->state.key_map, inx))
+ if (inx < 0)
{
- my_errno=HA_ERR_WRONG_INDEX;
+ my_errno= HA_ERR_WRONG_INDEX;
+ return -1;
+ }
+ if (!mi_is_key_active(info->s->state.key_map, inx))
+ {
+ my_errno= info->s->state.state.records ? HA_ERR_WRONG_INDEX :
+ HA_ERR_END_OF_FILE;
return -1;
}
if (info->lastinx != inx) /* Index changed */
@@ -240,12 +246,11 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
uchar *key, uint key_len, uint comp_flag, uchar **ret_pos,
uchar *buff, my_bool *last_key)
{
- int flag;
- uint nod_flag,length,not_used[2];
+ int UNINIT_VAR(flag);
+ uint nod_flag,UNINIT_VAR(length),not_used[2];
uchar t_buff[HA_MAX_KEY_BUFF],*end;
DBUG_ENTER("_mi_seq_search");
- LINT_INIT(flag); LINT_INIT(length);
end= page+mi_getint(page);
nod_flag=mi_test_if_nod(page);
page+=2+nod_flag;