summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorunknown <tsmith/tim@siva.hindu.god>2006-08-11 17:09:19 -0600
committerunknown <tsmith/tim@siva.hindu.god>2006-08-11 17:09:19 -0600
commit3212b399a85b3c985655b950443fe09133c0922c (patch)
tree43890922f6f076c8c9c4332a497d653ba7e9d7f7 /sql/item_strfunc.h
parent5a77e566abb4c486a296c1ad762ddfe740db695e (diff)
downloadmariadb-git-3212b399a85b3c985655b950443fe09133c0922c.tar.gz
Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
Make the encryption functions MD5(), SHA1() and ENCRYPT() return binary results. Make MAKE_SET() and EXPORT_SET() use the correct character set for their default separator strings. mysql-test/r/ctype_ucs.result: Add tests for bug #20536. mysql-test/t/ctype_ucs.test: Add tests for bug #20536. Tests showing correct behavior for MD5(), SHA1(), MAKE_SET() and EXPORT_SET(). Also, tests showing incorrect behavior, which will remain "Won't fix", for PASSWORD(), OLD_PASSWORD(), ENCRYPT() and QUOTE(). sql/item_strfunc.cc: Make the encryption functions MD5(), SHA1() and ENCRYPT() return binary results. Make MAKE_SET() and EXPORT_SET() use the correct character set for their default separator strings. sql/item_strfunc.h: Make the encryption functions MD5(), SHA1() and ENCRYPT() return binary results.
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index f800c17182b..d3e2d24099b 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -41,7 +41,10 @@ class Item_func_md5 :public Item_str_func
{
String tmp_value;
public:
- Item_func_md5(Item *a) :Item_str_func(a) {}
+ Item_func_md5(Item *a) :Item_str_func(a)
+ {
+ collation.set(&my_charset_bin);
+ }
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "md5"; }
@@ -51,7 +54,10 @@ public:
class Item_func_sha :public Item_str_func
{
public:
- Item_func_sha(Item *a) :Item_str_func(a) {}
+ Item_func_sha(Item *a) :Item_str_func(a)
+ {
+ collation.set(&my_charset_bin);
+ }
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "sha"; }
@@ -306,9 +312,21 @@ public:
class Item_func_encrypt :public Item_str_func
{
String tmp_value;
+
+ /* Encapsulate common constructor actions */
+ void constructor_helper()
+ {
+ collation.set(&my_charset_bin);
+ }
public:
- Item_func_encrypt(Item *a) :Item_str_func(a) {}
- Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
+ Item_func_encrypt(Item *a) :Item_str_func(a)
+ {
+ constructor_helper();
+ }
+ Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b)
+ {
+ constructor_helper();
+ }
String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = 13; }
const char *func_name() const { return "ecrypt"; }