From 7ef74ddc63bfc73da170508ced639c77714f0df4 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sun, 3 Mar 2024 19:24:18 +0100 Subject: [PATCH] Support additional UCA collations introduced in MariaDB 10.10.1. Closes #1917 --- source/dbconnection.pas | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 7f35cdeb..ee366b79 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -2075,6 +2075,7 @@ begin FMaxRowsPerInsert := 10000; FCaseSensitivity := 0; FStringQuoteChar := ''''; + FCollationTable := nil; end; @@ -5328,8 +5329,19 @@ end; function TMySQLConnection.GetCollationTable: TDBQuery; begin inherited; - if (not Assigned(FCollationTable)) and (ServerVersionInt >= 40100) then - FCollationTable := GetResults('SHOW COLLATION'); + if (not Assigned(FCollationTable)) and (ServerVersionInt >= 40100) then begin + if Parameters.IsMariaDB and (ServerVersionInt >= 101001) then try + // Issue #1917: MariaDB 10.10.1+ versions have additional collations in IS.COLLATION_CHARACTER_SET_APPLICABILITY + FCollationTable := GetResults('SELECT FULL_COLLATION_NAME AS '+QuoteIdent('Collation')+ + ' FROM '+QuoteIdent(InfSch)+'.COLLATION_CHARACTER_SET_APPLICABILITY'+ + ' ORDER BY '+QuoteIdent('Collation') + ); + except + on E:EDbError do; + end; + if not Assigned(FCollationTable) then + FCollationTable := GetResults('SHOW COLLATION'); + end; if Assigned(FCollationTable) then FCollationTable.First; Result := FCollationTable;