Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Incomplete
-
10.0.32
Description
i use heidisql
I have a big problem with using the encoding and decode built-in functions, so I'm posting a bug issue.
Here is the query:
ENCODE('ABC10','11')
query result 0x4D5F10253F
and this is value use decode function
Here is the query
cast(DECODE(0x4D5F10253F,'11') as char(14))
but decode result value "ABC1?"
I think the data is broken, but I do not know what the problem is.
MariaDB [test]> show global variables like "c%";
|
+--------------------------+----------------------------+
|
| Variable_name | Value |
|
+--------------------------+----------------------------+
|
| character_set_client | latin1 |
|
| character_set_connection | latin1 |
|
| character_set_database | latin1 |
|
| character_set_filesystem | binary |
|
| character_set_results | latin1 |
|
| character_set_server | latin1 |
|
| character_set_system | utf8 |
|
| character_sets_dir | /usr/share/mysql/charsets/ |
|
| collation_connection | latin1_swedish_ci |
|
| collation_database | latin1_swedish_ci |
|
| collation_server | latin1_swedish_ci |
|
| completion_type | NO_CHAIN |
|
| concurrent_insert | AUTO |
|
| connect_timeout | 10 |
|
+--------------------------+----------------------------+
|
Result of ENCODE function is a binary string, while result, that is presented in HeidiSQL is hex, and the number is not correct.
MariaDB [(none)]> select hex(ENCODE('ABC10','11')), DECODE(0x4D5F1025E7,'11'), cast(DECODE(0x4D5F1025E7,'11') as char(14));
+---------------------------+---------------------------+---------------------------------------------+
| hex(ENCODE('ABC10','11')) | DECODE(0x4D5F1025E7,'11') | cast(DECODE(0x4D5F1025E7,'11') as char(14)) |
+---------------------------+---------------------------+---------------------------------------------+
| 4D5F1025E7 | ABC10 | ABC10 |
+---------------------------+---------------------------+---------------------------------------------+
1 row in set (0.00 sec)