Ads were blocked by your webbrowser.

This is not a problem, but keep in mind that developing HeidiSQL, user support and hosting takes time and money.

You may want to send a donation instead.

DECODE works not properly on 9.4.0.5145

honteello posted 2 years ago in Running SQL scripts

Short test:

SET @TEST = ENCODE('test', 'mykey$'); SELECT @TEST; SELECT DECODE(@TEST, 'mykey$');

Outputs: 0xA0227630 0x74657374

So, second one must be actually a 'test' string again, but its returns 0x74657374 (?)

The same code on MySQL server works properly.

Is a bug or i doing something wrong?

kalvaro posted 2 years ago

HeidiSQL is a MySQL client, it doesn't run SQL functions by itself, it only displays what the server sends back.

Stuff that starts with 0x is an hexadecimal number. In this case, if you look carefully, you'll realise it's the UTF-8 encoding of the text "test". To see binary output as text you can click on the "View binary data as text (instead of HEX)" toolbar button.

honteello posted 2 years ago

Hello kalvaro, thanks a lot for explanation! :)

Stuff that starts with 0x is an hexadecimal number. In this case, if you look carefully, you'll realise it's the UTF-8 encoding of the text "test". To see binary output as text you can click on the "View binary data as text (instead of HEX)" toolbar button.

Please login to leave a reply, or register at first.