summaryrefslogtreecommitdiff
path: root/sql/item_row.cc
diff options
context:
space:
mode:
authorkostja@bodhi.local <>2006-08-30 03:00:19 +0400
committerkostja@bodhi.local <>2006-08-30 03:00:19 +0400
commitebb70704303ef3f7e227e8102d8eb4b466bdd9e4 (patch)
tree844b46ab5d82eec374f925e63be3812e697f87e3 /sql/item_row.cc
parent0368914b9a22891e9eac2b8a77dfbe43ea80c820 (diff)
parent3bf609b7f2b73555b1e241dc7c354818b0bbbc5a (diff)
downloadmariadb-git-ebb70704303ef3f7e227e8102d8eb4b466bdd9e4.tar.gz
Merge bodhi.local:/opt/local/work/mysql-5.0-runtime-safemerge
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
Diffstat (limited to 'sql/item_row.cc')
-rw-r--r--sql/item_row.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/item_row.cc b/sql/item_row.cc
index c7b678323a8..6e71ae0d4db 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -156,12 +156,22 @@ bool Item_row::walk(Item_processor processor, bool walk_subquery, byte *arg)
Item *Item_row::transform(Item_transformer transformer, byte *arg)
{
+ DBUG_ASSERT(!current_thd->is_stmt_prepare());
+
for (uint i= 0; i < arg_count; i++)
{
Item *new_item= items[i]->transform(transformer, arg);
if (!new_item)
return 0;
- items[i]= new_item;
+
+ /*
+ THD::change_item_tree() should be called only if the tree was
+ really transformed, i.e. when a new item has been created.
+ Otherwise we'll be allocating a lot of unnecessary memory for
+ change records at each execution.
+ */
+ if (items[i] != new_item)
+ current_thd->change_item_tree(&items[i], new_item);
}
return (this->*transformer)(arg);
}