diff options
author | Michael Widenius <monty@askmonty.org> | 2010-08-05 22:56:11 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-08-05 22:56:11 +0300 |
commit | d042146e5b41b6222df3e6b4c16a44f3ef2939b7 (patch) | |
tree | e40f5b435f7d17ed1c24dfb787ab8cd5f4f7d5d8 /sql/sql_handler.cc | |
parent | 3e610bc58d0ba325fdca3b06dfa976ecc513dc1e (diff) | |
parent | f0f21036951f6fed2fddeb58375425f957751fd5 (diff) | |
download | mariadb-git-d042146e5b41b6222df3e6b4c16a44f3ef2939b7.tar.gz |
Merge with MariaDB 5.1.49
Removed references to HA_END_SPACE_KEY (which has been 0 for a long time)
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r-- | sql/sql_handler.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 61f29886da8..69be8c8e9b4 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -539,6 +539,14 @@ retry: my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias); goto err; } + /* Check if the same index involved. */ + if ((uint) keyno != table->file->get_index()) + { + if (mode == RNEXT) + mode= RFIRST; + else if (mode == RPREV) + mode= RLAST; + } } if (insert_fields(thd, &thd->lex->select_lex.context, @@ -561,9 +569,16 @@ retry: case RNEXT: if (table->file->inited != handler::NONE) { - error=keyname ? - table->file->ha_index_next(table->record[0]) : - table->file->ha_rnd_next(table->record[0]); + if (keyname) + { + /* Check if we read from the same index. */ + DBUG_ASSERT((uint) keyno == table->file->get_index()); + error= table->file->ha_index_next(table->record[0]); + } + else + { + error= table->file->ha_rnd_next(table->record[0]); + } break; } /* else fall through */ @@ -584,6 +599,8 @@ retry: break; case RPREV: DBUG_ASSERT(keyname != 0); + /* Check if we read from the same index. */ + DBUG_ASSERT((uint) keyno == table->file->get_index()); if (table->file->inited != handler::NONE) { error=table->file->ha_index_prev(table->record[0]); |