TO_BASE64

Stai visualizzando una vecchia versione di questo article. Visualizza la versione più recente.
MariaDB starting with 10.0.5

La funzione TO_BASE64() è stata introdotta in MariaDB 10.0.5.

Sintassi

TO_BASE64(str)

Spiegazione

Converte l'argomento stringa str in una forma base-64 e restituisce il risultato come stringa di caratteri con il set di caratteri e la collation usati dalla connessione.

L'argomento str, se non è una stringa, viene prima di tutto convertito. Se è NULL restituisce come risultato NULL.

La funzione inversa, FROM_BASE64(), decodifica una stringa che ha base-64.

Vi sono molti modi per convertire una stringa in base-64. I seguenti sono usati da MariaDB e MySQL:

  • Il valore alfabetico 64 è codificato come '+'.
  • Il valore alfabetico 63 è codificato come '/'.
  • Encoding output is made up of groups of four printable characters, with each three bytes of data encoded using four characters. If the final group is not complete, it is padded with '=' characters to make up a length of four.
  • To divide long output, a newline is added after every 76 characters.
  • Decoding will recognize and ignore newlines, carriage returns, tabs, and spaces.

Examples

SELECT TO_BASE64('Maria');
+--------------------+
| TO_BASE64('Maria') |
+--------------------+
| TWFyaWE=           |
+--------------------+

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.