summaryrefslogtreecommitdiff
path: root/sql/sql_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r--sql/sql_handler.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 0505d2409d4..7c07c08bcac 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -163,10 +163,13 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
{
switch (mode) {
case RFIRST:
- err=keyname ?
- table->file->index_first(table->record[0]) :
- table->file->rnd_init(1) ||
- table->file->rnd_next(table->record[0]);
+ if (keyname)
+ err=table->file->index_first(table->record[0]);
+ else
+ {
+ if (!(err=table->file->rnd_init(1)))
+ err=table->file->rnd_next(table->record[0]);
+ }
mode=RNEXT;
break;
case RLAST: