[MDEV-16081] encode decode result data decay Created: 2018-05-03  Updated: 2018-11-01  Resolved: 2018-11-01

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.0.32
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Eun SIk Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: need_feedback

Attachments: PNG File KakaoTalk_20180503_161305789.png    

 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                         |
+--------------------------+----------------------------+



 Comments   
Comment by Alice Sherepa [ 2018-05-08 ]

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)

Comment by Elena Stepanova [ 2018-10-04 ]

So, it's a HeidiSQL bug? It should probably be reported to them, then.
cplus, can you confirm that you're getting the expected result without HeidiSQL?

Generated at Thu Feb 08 08:26:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.