summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorkonstantin@mysql.com <>2005-07-13 23:49:45 +0400
committerkonstantin@mysql.com <>2005-07-13 23:49:45 +0400
commitb6da7f6227694c5c8afb6e4cf20765107f6b7516 (patch)
tree3e265a285c2d54f0456bc427c1ecefe755ffbfe3 /sql/item_func.cc
parenta25c4ead106bf36d0c9a5f18f9477bf238bcc05d (diff)
parent1755df76498e9ce0941800525a488ae45b841074 (diff)
downloadmariadb-git-b6da7f6227694c5c8afb6e4cf20765107f6b7516.tar.gz
Merge mysql.com:/opt/local/work/mysql-4.1-9379
into mysql.com:/opt/local/work/mysql-5.0-root
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 7576bca6701..296083b256e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -193,10 +193,23 @@ bool Item_func::agg_arg_charsets(DTCollation &coll,
if ((*arg)->type() == FIELD_ITEM)
((Item_field *)(*arg))->no_const_subst= 1;
/*
+ If in statement prepare, then we create a converter for two
+ constant items, do it once and then reuse it.
+ If we're in execution of a prepared statement, arena is NULL,
+ and the conv was created in runtime memory. This can be
+ the case only if the argument is a parameter marker ('?'),
+ because for all true constants the charset converter has already
+ been created in prepare. In this case register the change for
+ rollback.
+ */
+ if (arena)
+ *arg= conv;
+ else
+ thd->change_item_tree(arg, conv);
+ /*
We do not check conv->fixed, because Item_func_conv_charset which can
be return by safe_charset_converter can't be fixed at creation
*/
- *arg= conv;
conv->fix_fields(thd, arg);
}
if (arena)