1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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
This commit is contained in:
Alexander Barkov
2010-07-07 10:38:11 +04:00
parent 72bb9b7acb
commit 00e86d01a7
4 changed files with 44 additions and 13 deletions

View File

@ -481,3 +481,16 @@ SELECT LENGTH(SHA2( '', 224 )) / 2 * 8 = 224;
SELECT LENGTH(SHA2( 'any', 256 )) / 2 * 8 = 256;
SELECT LENGTH(SHA2( 'size', 384 )) / 2 * 8 = 384;
SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512;
--echo #
--echo # Bug#54661 sha2() returns BINARY result
--echo #
--enable_metadata
SET NAMES binary;
SELECT sha2('1',224);
SET NAMES utf8;
SELECT sha2('1',224);
SET NAMES latin1;
SELECT sha2('1',224);
--disable_metadata