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

Merge TO_BASE64() and FROM_BASE64() from MySQL-5.6

Details

    • Task
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.0.6
    • None
    • None

    Description

      MySQL-5.6 implemented SQL functions TO_BASE64() and FROM_BASE64().
      We should merge those two into MariaDB.

      Attachments

        Issue Links

          Activity

            Merged from MySQL-5.6. to MariaDB-10.0.5

            bar Alexander Barkov added a comment - Merged from MySQL-5.6. to MariaDB-10.0.5
            1222tmiller Tom Miller added a comment -

            TO_BASE64 doesn't work on binaries. With web and HTML being king and embedded images usually being in BASE64, it would be nice if this works. It comes close but does a lot of extra "\" for some reason. Supposedly it works fine in MYSQL. I am not sure if this should be reported as a bug or an enhancement or maybe reconsider doing another merge from MYSQL to get the additional functionality of converting BLOB type along with strings.

            1222tmiller Tom Miller added a comment - TO_BASE64 doesn't work on binaries. With web and HTML being king and embedded images usually being in BASE64, it would be nice if this works. It comes close but does a lot of extra "\" for some reason. Supposedly it works fine in MYSQL. I am not sure if this should be reported as a bug or an enhancement or maybe reconsider doing another merge from MYSQL to get the additional functionality of converting BLOB type along with strings.

            I’m using this for many years with blob, maybe you are using a wrong bytes encoding at client (ut8 or something like it is converting to string)

            rspadim roberto spadim added a comment - I’m using this for many years with blob, maybe you are using a wrong bytes encoding at client (ut8 or something like it is converting to string)
            1222tmiller Tom Miller added a comment -

            CREATE OR REPLACE DATABASE `my-database` CHARACTER SET = 'utf8mb3' COLLATE = 'utf8mb3_general_ci';
            Why would TO_BASE64 care about the character set? That sounds like a bug if it does.

            There are no instructions on how to properly do this. The help page only talks about converting a string to BASE64, not a BLOB.
            I take the result from a development tool (I think an ODBC driver), from the command line, and Thunder Test in VSCODE using MariaDb's node driver and all fail when I copy them to a website that converts BASE64 to an image.

            This converts it every time in the Node.js / Express.js server we use:
            var strBase64 = dbResponse[0][0].UserPictureBlob.toString("base64");

            I copy the string to the webpage and the image shows up every time without error.

            1222tmiller Tom Miller added a comment - CREATE OR REPLACE DATABASE `my-database` CHARACTER SET = 'utf8mb3' COLLATE = 'utf8mb3_general_ci'; Why would TO_BASE64 care about the character set? That sounds like a bug if it does. There are no instructions on how to properly do this. The help page only talks about converting a string to BASE64, not a BLOB. I take the result from a development tool (I think an ODBC driver), from the command line, and Thunder Test in VSCODE using MariaDb's node driver and all fail when I copy them to a website that converts BASE64 to an image. This converts it every time in the Node.js / Express.js server we use: var strBase64 = dbResponse [0] [0] .UserPictureBlob.toString("base64"); I copy the string to the webpage and the image shows up every time without error.

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.