Details

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

      Attachments

        Activity

          alice Alice Sherepa added a comment -

          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)
          

          alice Alice Sherepa added a comment - 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)

          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?

          elenst Elena Stepanova added a comment - 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?

          People

            Unassigned Unassigned
            cplus Eun SIk
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.