COMPRESS

Sintassi

COMPRESS(stringa_da_comprimere)

Spiegazione

Comprime una stringa e restituisce il risultato come stringa binaria. Questa funzione richiede che MariaDB sia stata compilata con una libreria di compressione, come zlib. Altrimenti il valore restituito sarà sempre NULL. La stringa compressa potrà essere decompressa con UNCOMPRESS().

Esempi

MariaDB [(none)]> SELECT LENGTH(COMPRESS(REPEAT('a',1000)));
+------------------------------------+
| LENGTH(COMPRESS(REPEAT('a',1000))) |
+------------------------------------+
|                                 21 |
+------------------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> SELECT LENGTH(COMPRESS(''));
+----------------------+
| LENGTH(COMPRESS('')) |
+----------------------+
|                    0 |
+----------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> SELECT LENGTH(COMPRESS('a'));
+-----------------------+
| LENGTH(COMPRESS('a')) |
+-----------------------+
|                    13 |
+-----------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> SELECT LENGTH(COMPRESS(REPEAT('a',16)));
+----------------------------------+
| LENGTH(COMPRESS(REPEAT('a',16))) |
+----------------------------------+
|                               15 |
+----------------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> 

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.