Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions libraries/classes/Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ public function getTypeDescription($type)
case 'JSON':
return __('Stores and enables efficient access to data in JSON (JavaScript Object Notation) documents');

case 'INET4':
return __('Intended for storage of IPv4 addresses');

case 'INET6':
return __('Intended for storage of IPv6 addresses, as well as IPv4 '
. 'addresses assuming conventional mapping of IPv4 addresses '
Expand Down Expand Up @@ -503,6 +506,7 @@ public function getTypeClass($type)
case 'LONGBLOB':
case 'ENUM':
case 'SET':
case 'INET4':
case 'INET6':
return 'CHAR';

Expand Down Expand Up @@ -854,6 +858,11 @@ public function getColumns(): array
];
if ($isMariaDB && $serverVersion >= 100500) {
$stringTypes[] = '-';

if ($serverVersion >= 101000) {
$stringTypes[] = 'INET4';
}

$stringTypes[] = 'INET6';
}

Expand Down
69 changes: 69 additions & 0 deletions test/classes/TypesByDatabaseVersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,75 @@ public static function providerFortTestGetColumns(): array
'UUID' => [ 'UUID' ],
],
],
'mariadb 10.10.0 - support INET4, INET6, JSON and UUID' => [
'mariadb',
101000,
[
0 => 'INT',
1 => 'VARCHAR',
2 => 'TEXT',
3 => 'DATE',
4 => 'UUID',
'Numeric' => [
'TINYINT',
'SMALLINT',
'MEDIUMINT',
'INT',
'BIGINT',
'-',
'DECIMAL',
'FLOAT',
'DOUBLE',
'REAL',
'-',
'BIT',
'BOOLEAN',
'SERIAL',
],
'Date and time' => [
'DATE',
'DATETIME',
'TIMESTAMP',
'TIME',
'YEAR',
],
'String' => [
'CHAR',
'VARCHAR',
'-',
'TINYTEXT',
'TEXT',
'MEDIUMTEXT',
'LONGTEXT',
'-',
'BINARY',
'VARBINARY',
'-',
'TINYBLOB',
'BLOB',
'MEDIUMBLOB',
'LONGBLOB',
'-',
'ENUM',
'SET',
'-',
'INET4',
'INET6',
],
'Spatial' => [
'GEOMETRY',
'POINT',
'LINESTRING',
'POLYGON',
'MULTIPOINT',
'MULTILINESTRING',
'MULTIPOLYGON',
'GEOMETRYCOLLECTION',
],
'JSON' => [ 'JSON' ],
'UUID' => [ 'UUID' ],
],
],
];
}

Expand Down
1 change: 1 addition & 0 deletions test/classes/TypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ public static function providerForTestGetTypeDescription(): array
['MULTIPOLYGON'],
['GEOMETRYCOLLECTION'],
['JSON'],
['INET4'],
['INET6'],
['UUID'],
['XMLTYPE'],
Expand Down
Loading