diff options
author | Alexander Barkov <bar@mysql.com> | 2010-07-07 10:38:11 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mysql.com> | 2010-07-07 10:38:11 +0400 |
commit | 00e86d01a72c539b915e07f4b7b8fe218433fd60 (patch) | |
tree | e872e3c1b1d8935b62347e5c4fd395d237b68567 /sql/item_strfunc.h | |
parent | 72bb9b7acbacc20172512184dc2724fccbc7a741 (diff) | |
download | mariadb-git-00e86d01a72c539b915e07f4b7b8fe218433fd60.tar.gz |
Bug#54661 sha2() returns BINARY result
Problem: sha2() reported its result as BINARY
Fix:
- Inheriting Item_func_sha2 from Item_str_ascii_func
- Setting max_length via fix_length_and_charset()
instead of direct assignment.
- Adding tests
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 2a34babae87..df794ecaaf4 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -82,16 +82,13 @@ public: const char *func_name() const { return "sha"; } }; -class Item_func_sha2 :public Item_str_func +class Item_func_sha2 :public Item_str_ascii_func { public: - Item_func_sha2(Item *a, Item *b) :Item_str_func(a, b) - { - collation.set(&my_charset_bin); - } - String *val_str(String *); - void fix_length_and_dec(); - const char *func_name() const { return "sha2"; } + Item_func_sha2(Item *a, Item *b) :Item_str_ascii_func(a, b) {} + String *val_str_ascii(String *); + void fix_length_and_dec(); + const char *func_name() const { return "sha2"; } }; class Item_func_aes_encrypt :public Item_str_func |