Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12169

port "Print binary data as hex in the mysql client" by @dveeden

    XMLWordPrintable

Details

    Description

      original code: mysql/mysql-server#118
       
      MariaDB [test]> create table t1(id binary(16) primary key, name varchar(100));
      Query OK, 0 rows affected (0.03 sec)
       
      MariaDB [test]> insert into t1 values(unhex(replace(uuid(),'-','')), 'test 1');
      Query OK, 1 row affected (0.00 sec)
       
      MariaDB [test]> insert into t1 values(unhex(replace(uuid(),'-','')), 'test 2');
      Query OK, 1 row affected (0.00 sec)
       
      MariaDB [test]> insert into t1 values(unhex(replace(uuid(),'-','')), 'test 3');
      Query OK, 1 row affected (0.00 sec)
       
      MariaDB [test]> select * from t1;
      +------------------+--------+
      | id | name |
      +------------------+--------+
      | ^_?m?T?dl?^T?|H | test 1 |
      | !?T?dl?^T?|H | test 2 |
      | #t1?T??dl?^T??|H | test 3 |
      +------------------+--------+
      3 rows in set (0.00 sec)
       
      With the addition of this patch, the following is possible:
       
      MariaDB [test]> select * from t1;
      +------------------------------------+--------+
      | id | name |
      +------------------------------------+--------+
      | 0x1FE6166DFF5411E6AB646C8814987C48 | test 1 |
      | 0x21EFDCB2FF5411E6AB646C8814987C48 | test 2 |
      | 0x237431D4FF5411E6AB646C8814987C48 | test 3 |
      +------------------------------------+--------+
      3 rows in set (0.00 sec)
       
      MariaDB [test]> select * from t1 where id = 0x21EFDCB2FF5411E6AB646C8814987C48;
      +------------------------------------+--------+
      | id | name |
      +------------------------------------+--------+
      | 0x21EFDCB2FF5411E6AB646C8814987C48 | test 2 |
      +------------------------------------+--------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> select * from t1\G
      *************************** 1. row ***************************
      id: 0x1FE6166DFF5411E6AB646C8814987C48
      name: test 1
      *************************** 2. row ***************************
      id: 0x21EFDCB2FF5411E6AB646C8814987C48
      name: test 2
      *************************** 3. row ***************************
      id: 0x237431D4FF5411E6AB646C8814987C48
      name: test 3
      3 rows in set (0.01 sec)
       
      This patch also introduces the new option --binary-as-hex=0 in
      order to disable this new behavior.
      

      Attachments

        Activity

          People

            svoj Sergey Vojtovich
            svoj Sergey Vojtovich
            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.