How UNHEX() Works in MariaDB

In MariaDB, UNHEX() is a built-in string function that performs the inverse operation of the HEX() function.

Whereas, the HEX() function returns a hexadecimal representation of a given string, the UNHEX() function returns the string representation of a given hexadecimal value.

Specifically, UNHEX() interprets each pair of hexadecimal digits in its argument as a number, and then converts it to the character represented by the number.

The result is returned as a binary string.

Continue reading

3 Ways to Show the Collation for your Connection in MariaDB

When you run a query against a MariaDB database, MariaDB uses a bunch of system variables to determine which character set and collation to use whenever queries are run. If the client uses a different character set to the server, then MariaDB can translate it into an appropriate character set and collation.

When sending the query results back to the client, MariaDB can translate these results back to a different character set altogether if required. MariaDB uses system variables to determine which character sets and collations to use at each of these steps.

Here are three ways to show the connection collation in MariaDB.

Continue reading