summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-07-13 23:49:45 +0400
committerunknown <konstantin@mysql.com>2005-07-13 23:49:45 +0400
commit061406ba21d778037a3ccfcb7bece953e2d2b5e5 (patch)
tree3e265a285c2d54f0456bc427c1ecefe755ffbfe3 /sql/item_func.cc
parentb7033fb37b0ef2f1e46c97f8749a714840abdc68 (diff)
parent98248f046fbaa30b098225f408f4b5529ae937e6 (diff)
downloadmariadb-git-061406ba21d778037a3ccfcb7bece953e2d2b5e5.tar.gz
Merge mysql.com:/opt/local/work/mysql-4.1-9379
into mysql.com:/opt/local/work/mysql-5.0-root sql/item.cc: Auto merged mysql-test/r/ps.result: Manual merge. mysql-test/t/ps.test: Manual merge. sql/item_func.cc: Manual merge.
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)