diff options
author | Fawzi E. Abdulfattah <iifawzie@gmail.com> | 2022-07-22 20:26:02 +0300 |
---|---|---|
committer | William Desportes <williamdes@wdes.fr> | 2022-10-01 00:11:22 +0300 |
commit | 1be3cad6e3004b875d85341cb3cf1edac637d2a2 (patch) | |
tree | fce11b72e9b4c000896dce4e273b8827e85ca15f /libraries | |
parent | b5e20ad8f4bdbcf18aa9662d612338aa1cdcdf93 (diff) |
Supporting the compressed option for MariaDB
Ref: #14956
Signed-off-by: Fawzi E. Abdulfattah <iifawzie@gmail.com>
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/classes/Types.php | 11 | ||||
-rw-r--r-- | libraries/classes/Util.php | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/libraries/classes/Types.php b/libraries/classes/Types.php index 12f7a7e4cf..e2deae064d 100644 --- a/libraries/classes/Types.php +++ b/libraries/classes/Types.php @@ -713,13 +713,22 @@ class Types */ public function getAttributes() { - return [ + $isMariaDB = $this->dbi->isMariaDB(); + $serverVersion = $this->dbi->getVersion(); + + $attributes = [ '', 'BINARY', 'UNSIGNED', 'UNSIGNED ZEROFILL', 'on update CURRENT_TIMESTAMP', ]; + + if ($isMariaDB && $serverVersion >= 100100) { + $attributes[] = 'COMPRESSED=zlib'; + } + + return $attributes; } /** diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index 8338d8e003..0d39ca8bae 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -1373,6 +1373,7 @@ class Util $binary = false; $unsigned = false; $zerofill = false; + $compressed = false; } else { $enumSetValues = []; @@ -1394,6 +1395,8 @@ class Util $zerofill = ($zerofillCount > 0); $printType = (string) preg_replace('@unsigned@', '', $printType, -1, $unsignedCount); $unsigned = ($unsignedCount > 0); + $printType = (string) preg_replace('@\/\*!100301 compressed\*\/@', '', $printType, -1, $compressedCount); + $compressed = ($compressedCount > 0); $printType = trim($printType); } @@ -1410,6 +1413,10 @@ class Util $attribute = 'UNSIGNED ZEROFILL'; } + if ($compressed) { + $attribute = 'COMPRESSED=zlib'; + } + $canContainCollation = false; if (! $binary && preg_match('@^(char|varchar|text|tinytext|mediumtext|longtext|set|enum)@', $type)) { $canContainCollation = true; |