diff options
author | konstantin@mysql.com <> | 2005-07-13 23:43:46 +0400 |
---|---|---|
committer | konstantin@mysql.com <> | 2005-07-13 23:43:46 +0400 |
commit | 1755df76498e9ce0941800525a488ae45b841074 (patch) | |
tree | 11100dd4ca70231212f2ec0d9927ac5a3fafce1e /sql/item_func.cc | |
parent | 2ba359147f9ab9de607eaf860756a4d9c0b99f17 (diff) | |
download | mariadb-git-1755df76498e9ce0941800525a488ae45b841074.tar.gz |
A fix and a test case for Bug#9379 (collation of a parameter marker is
binary).
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 442ef15bba8..4e0b6d8813f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -188,7 +188,20 @@ bool Item_func::agg_arg_charsets(DTCollation &coll, break; // we cannot return here, we need to restore "arena". } conv->fix_fields(thd, 0, &conv); - *arg= conv; + /* + 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); } if (arena) thd->restore_backup_item_arena(arena, &backup); |