summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc35
1 files changed, 24 insertions, 11 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 1ec1e57e812..f2485fd50a1 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -3258,11 +3258,14 @@ int subselect_uniquesubquery_engine::scan_table()
TABLE *table= tab->table;
DBUG_ENTER("subselect_uniquesubquery_engine::scan_table");
- if (table->file->inited)
- table->file->ha_index_end();
-
- if (table->file->ha_rnd_init_with_error(1))
- DBUG_RETURN(1);
+ if ((table->file->inited &&
+ (error= table->file->ha_index_end())) ||
+ (error= table->file->ha_rnd_init(1)))
+ {
+ (void) report_error(table, error);
+ DBUG_RETURN(true);
+ }
+
table->file->extra_opt(HA_EXTRA_CACHE,
current_thd->variables.read_buff_size);
table->null_row= 0;
@@ -3398,8 +3401,13 @@ int subselect_uniquesubquery_engine::exec()
DBUG_RETURN(0);
}
- if (!table->file->inited)
- table->file->ha_index_init(tab->ref.key, 0);
+ if (!table->file->inited &&
+ (error= table->file->ha_index_init(tab->ref.key, 0)))
+ {
+ (void) report_error(table, error);
+ DBUG_RETURN(true);
+ }
+
error= table->file->ha_index_read_map(table->record[0],
tab->ref.key_buff,
make_prev_keypart_map(tab->
@@ -3563,8 +3571,13 @@ int subselect_indexsubquery_engine::exec()
DBUG_RETURN(0);
}
- if (!table->file->inited)
- table->file->ha_index_init(tab->ref.key, 1);
+ if (!table->file->inited &&
+ (error= table->file->ha_index_init(tab->ref.key, 1)))
+ {
+ (void) report_error(table, error);
+ DBUG_RETURN(true);
+ }
+
error= table->file->ha_index_read_map(table->record[0],
tab->ref.key_buff,
make_prev_keypart_map(tab->
@@ -5053,7 +5066,7 @@ bool Ordered_key::alloc_keys_buffers()
DBUG_ASSERT(key_buff_elements > 0);
if (!(key_buff= (rownum_t*) my_malloc((size_t)(key_buff_elements *
- sizeof(rownum_t)), MYF(MY_WME))))
+ sizeof(rownum_t)), MYF(MY_WME | MY_THREAD_SPECIFIC))))
return TRUE;
/*
@@ -5480,7 +5493,7 @@ subselect_rowid_merge_engine::init(MY_BITMAP *non_null_key_parts,
!(null_bitmaps= (MY_BITMAP**) thd->alloc(merge_keys_count *
sizeof(MY_BITMAP*))) ||
!(row_num_to_rowid= (uchar*) my_malloc((size_t)(row_count * rowid_length),
- MYF(MY_WME))))
+ MYF(MY_WME | MY_THREAD_SPECIFIC))))
return TRUE;
/* Create the only non-NULL key if there is any. */