summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-06-17 01:57:25 +0400
committerunknown <evgen@moonbone.local>2006-06-17 01:57:25 +0400
commit707de39a53c3a9d40cabc968475e83f45a754e2e (patch)
treedb342732a1b4d4b8c9c730075c5e4a1404d25e8f /sql/item_strfunc.cc
parentde292d67996bb238b43f4eaca3257e0a47544271 (diff)
parentca22a81b1c84ce81e1e9ea2c3ace7be1848027d8 (diff)
downloadmariadb-git-707de39a53c3a9d40cabc968475e83f45a754e2e.tar.gz
Merge moonbone.local:/home/evgen/bk-trees/mysql-4.1-opt
into moonbone.local:/work/tmp_merge-5.0-opt-mysql mysql-test/r/cast.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/t/func_str.test: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_strfunc.cc: Auto merged
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c7fa049a0d5..a51ebd39147 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -154,7 +154,15 @@ String *Item_func_md5::val_str(String *str)
void Item_func_md5::fix_length_and_dec()
{
- max_length=32;
+ max_length=32;
+ /*
+ The MD5() function treats its parameter as being a case sensitive. Thus
+ we set binary collation on it so different instances of MD5() will be
+ compared properly.
+ */
+ args[0]->collation.set(
+ get_charset_by_csname(args[0]->collation.collation->csname,
+ MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
}
@@ -195,7 +203,15 @@ String *Item_func_sha::val_str(String *str)
void Item_func_sha::fix_length_and_dec()
{
- max_length=SHA1_HASH_SIZE*2; // size of hex representation of hash
+ max_length=SHA1_HASH_SIZE*2; // size of hex representation of hash
+ /*
+ The SHA() function treats its parameter as being a case sensitive. Thus
+ we set binary collation on it so different instances of MD5() will be
+ compared properly.
+ */
+ args[0]->collation.set(
+ get_charset_by_csname(args[0]->collation.collation->csname,
+ MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
}
@@ -294,7 +310,8 @@ String *Item_func_concat::val_str(String *str)
if (!(res=args[0]->val_str(str)))
goto null;
use_as_buff= &tmp_value;
- is_const= args[0]->const_item();
+ /* Item_subselect in --ps-protocol mode will state it as a non-const */
+ is_const= args[0]->const_item() || !args[0]->used_tables();
for (i=1 ; i < arg_count ; i++)
{
if (res->length() == 0)