summaryrefslogtreecommitdiff
path: root/sql/sql_handler.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-01-10 23:42:47 +0200
committerMichael Widenius <monty@askmonty.org>2011-01-10 23:42:47 +0200
commit2eaa76b84426b19f8574876ad1fa85ae6cfe3196 (patch)
treec6d4ebe6e2b222092ecff7df1dc5cf5bfdcd9179 /sql/sql_handler.cc
parent934c57c77e19109943e45c9b94658efc107ded1e (diff)
parent505c663a1e19af4c8ee726b305691414ab5fc999 (diff)
downloadmariadb-git-2eaa76b84426b19f8574876ad1fa85ae6cfe3196.tar.gz
Automatic merge with 5.1
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r--sql/sql_handler.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 69be8c8e9b4..85b7e46a313 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -548,6 +548,12 @@ retry:
mode= RLAST;
}
}
+ else if (table->file->inited != handler::RND)
+ {
+ /* Convert RNEXT to RFIRST if we haven't started row scan */
+ if (mode == RNEXT)
+ mode= RFIRST;
+ }
if (insert_fields(thd, &thd->lex->select_lex.context,
tables->db, tables->alias, &it, 0))
@@ -569,6 +575,8 @@ retry:
case RNEXT:
if (table->file->inited != handler::NONE)
{
+ if ((error= table->file->can_continue_handler_scan()))
+ break;
if (keyname)
{
/* Check if we read from the same index. */
@@ -603,7 +611,9 @@ retry:
DBUG_ASSERT((uint) keyno == table->file->get_index());
if (table->file->inited != handler::NONE)
{
- error=table->file->ha_index_prev(table->record[0]);
+ if ((error= table->file->can_continue_handler_scan()))
+ break;
+ error= table->file->ha_index_prev(table->record[0]);
break;
}
/* else fall through */
@@ -673,8 +683,11 @@ retry:
continue;
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
{
- sql_print_error("mysql_ha_read: Got error %d when reading table '%s'",
- error, tables->table_name);
+ /* Don't give error in the log file for some expected problems */
+ if (error != HA_ERR_RECORD_CHANGED && error != HA_ERR_WRONG_COMMAND)
+ sql_print_error("mysql_ha_read: Got error %d when reading "
+ "table '%s'",
+ error, tables->table_name);
table->file->print_error(error,MYF(0));
goto err;
}