summaryrefslogtreecommitdiff
path: root/sql/item_buff.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2010-01-28 16:48:33 +0300
committerSergey Petrunya <psergey@askmonty.org>2010-01-28 16:48:33 +0300
commitf47b2d38f6c4851ef6bd069f5d1ffe033056d582 (patch)
tree84f3ebd6121f993eb30656da64790920566c5c46 /sql/item_buff.cc
parent742afd8eaeccb3531fa350b31445e8397dab7848 (diff)
downloadmariadb-git-f47b2d38f6c4851ef6bd069f5d1ffe033056d582.tar.gz
Subquery optimizations: non-semijoin materialization
- Backport into Maria DB 5.3, part 1
Diffstat (limited to 'sql/item_buff.cc')
-rw-r--r--sql/item_buff.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_buff.cc b/sql/item_buff.cc
index 2f45d0a17c2..037a988ebbc 100644
--- a/sql/item_buff.cc
+++ b/sql/item_buff.cc
@@ -27,11 +27,16 @@
Create right type of Cached_item for an item.
*/
-Cached_item *new_Cached_item(THD *thd, Item *item)
+Cached_item *new_Cached_item(THD *thd, Item *item, bool use_result_field)
{
if (item->real_item()->type() == Item::FIELD_ITEM &&
!(((Item_field *) (item->real_item()))->field->flags & BLOB_FLAG))
- return new Cached_item_field((Item_field *) (item->real_item()));
+ {
+ Item_field *real_item= (Item_field *) item->real_item();
+ Field *cached_field= use_result_field ? real_item->result_field :
+ real_item->field;
+ return new Cached_item_field(cached_field);
+ }
switch (item->result_type()) {
case STRING_RESULT:
return new Cached_item_str(thd, (Item_field *) item);