From ce3d29a99c74e48e2784054c3ea7170378677663 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Fri, 14 Jun 2024 13:59:40 +0200 Subject: [PATCH] Issue #1964: support MariaDB's INET4 and INET6 data types --- source/dbstructures.mysql.pas | 35 ++++++++++++++++++++++++++++++++++- source/dbstructures.pas | 5 +++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/source/dbstructures.mysql.pas b/source/dbstructures.mysql.pas index 7d091de8..7b0e5fe5 100644 --- a/source/dbstructures.mysql.pas +++ b/source/dbstructures.mysql.pas @@ -311,7 +311,7 @@ var // MySQL Data Type List and Properties - MySQLDatatypes: array [0..38] of TDBDatatype = + MySQLDatatypes: array [0..40] of TDBDatatype = ( ( Index: dbdtUnknown; @@ -690,6 +690,39 @@ var LoadPart: False; Category: dtcText; ), + ( + Index: dbdtInet4; + NativeType: 255; + Name: 'INET4'; + Description: 'INET4' + sLineBreak + + 'INET4 is a data type to store IPv4 addresses, as 4-byte binary strings. '+ + 'It was added in MariaDB 10.10.0'; + HasLength: False; + RequiresLength: False; + HasBinary: False; + HasDefault: True; + LoadPart: False; + Category: dtcText; + MinVersion: 10100; + ), + ( + Index: dbdtInet6; + NativeType: 255; + Name: 'INET6'; + Description: 'INET6' + sLineBreak + + 'The INET6 data type is intended for storage of IPv6 addresses, as well as ' + + 'IPv4 addresses assuming conventional mapping of IPv4 addresses into IPv6 ' + + 'addresses. ' + slineBreak + + 'Both short and long IPv6 notation are permitted, according to RFC-5952. '+ + 'It was added in MariaDB 10.5.0'; + HasLength: False; + RequiresLength: False; + HasBinary: False; + HasDefault: True; + LoadPart: False; + Category: dtcText; + MinVersion: 10050; + ), ( Index: dbdtBinary; NativeType: 254; diff --git a/source/dbstructures.pas b/source/dbstructures.pas index 3743cd16..64e9c839 100644 --- a/source/dbstructures.pas +++ b/source/dbstructures.pas @@ -6,7 +6,7 @@ interface uses - gnugettext, Vcl.Graphics, Winapi.Windows, System.SysUtils; + gnugettext, Vcl.Graphics, Winapi.Windows, System.SysUtils, System.Classes; type @@ -19,7 +19,7 @@ type dbdtJson, dbdtJsonB, dbdtCidr, dbdtInet, dbdtMacaddr, dbdtBinary, dbdtVarbinary, dbdtTinyblob, dbdtBlob, dbdtMediumblob, dbdtLongblob, dbdtImage, dbdtEnum, dbdtSet, dbdtBit, dbdtVarBit, dbdtBool, dbdtRegClass, dbdtRegProc, dbdtUnknown, - dbdtCursor, dbdtSqlvariant, dbdtTable, dbdtUniqueidentifier, dbdtHierarchyid, dbdtXML, + dbdtCursor, dbdtSqlvariant, dbdtTable, dbdtUniqueidentifier, dbdtInet4, dbdtInet6, dbdtHierarchyid, dbdtXML, dbdtPoint, dbdtLinestring, dbdtLineSegment, dbdtPolygon, dbdtGeometry, dbdtBox, dbdtPath, dbdtCircle, dbdtMultipoint, dbdtMultilinestring, dbdtMultipolygon, dbdtGeometrycollection ); @@ -45,6 +45,7 @@ type Format: String; // Used for date/time values when displaying and generating queries ValueMustMatch: String; Category: TDBDatatypeCategoryIndex; + MinVersion: Integer; end; // Column type category structure