From 2593b14ccb4d70d3f3b58f5d3fab886c1c4af7a0 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Fri, 6 May 2011 15:39:40 +0400 Subject: Preliminary patch for Bug#11848763 / 60025 (SUBSTRING inside a stored function works too slow). Background: - THD classes derives from Query_arena, thus inherits the 'state' attribute and related operations (is_stmt_prepare() & co). - Although these operations are available in THD, they must not be used. THD has its own attribute to point to the active Query_arena -- stmt_arena. - So, instead of using thd->is_stmt_prepare(), thd->stmt_arena->is_stmt_prepare() must be used. This was the root cause of Bug 60025. This patch enforces the proper way of calling those operations. is_stmt_prepare() & co are declared as private operations in THD (thus, they are hidden from being called on THD instance). The patch tries to minimize changes in 5.5. --- sql/item.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sql/item.cc') diff --git a/sql/item.cc b/sql/item.cc index af3917c09c1..788c7744c14 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -581,7 +581,7 @@ void Item::rename(char *new_name) Item* Item::transform(Item_transformer transformer, uchar *arg) { - DBUG_ASSERT(!current_thd->is_stmt_prepare()); + DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare()); return (this->*transformer)(arg); } @@ -1845,7 +1845,7 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname, been created in prepare. In this case register the change for rollback. */ - if (thd->is_stmt_prepare()) + if (thd->stmt_arena->is_stmt_prepare()) *arg= conv; else thd->change_item_tree(arg, conv); @@ -6965,7 +6965,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions) Item *Item_default_value::transform(Item_transformer transformer, uchar *args) { - DBUG_ASSERT(!current_thd->is_stmt_prepare()); + DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare()); /* If the value of arg is NULL, then this object represents a constant, -- cgit v1.2.1