Custom Collations SQLite stores and handles all character data either in UTF8 or UTF16, depending on the OpenMode connection parameter. When SQLite needs to compare or sort a character data, it has to know what rules to use for this. The rules are known as a collation.
SQLite has several build-in collations. None of them produces a correct sorting for German, Cyrillic, Arabian, and so on phrases. You have to use the TFDSQLiteCollation component to build your own collation. Set CollationName, Flags, LocaleName, then set Active to True to register the collation with the SQLite engine. For example:
FDSQLiteCollation1.DriverLink := FDPhysSQLiteDriverLink1; FDSQLiteCollation1.CollationName := 'UTF16NoCase'; FDSQLiteCollation1.Flags := [sfIgnoreCase]; FDSQLiteCollation1.Active := True; The component setup above with default Collation_Kind=scCompareString implements a standard case-insensitive Unicode collation. The application can implement custom collations using Collation_Kind=scCustomUTF16 or scCustomUTF8 and implementing the OnCompare event handler. This is how you can use this collation:
SELECT * FROM "Employees" ORDER BY LastName COLLATE UTF16NoCase To specify the default collation for a column you can do the following:
CREATE TABLE IF NOT EXISTS test_col (f1 VARCHAR(10) COLLATE UTF16NoCase) Note: If there is no ability to specify the default collation for a connection, a database, or a table. You can find the above collation samples in the FireDAC\Samples\DBMS Specific\SQLite\UserCollation folder. If you do not use custom collations, then by default SQLite uses a binary sorting order. For the TFDTable Live Data Window mode, it is important to have the same client side and database sorting orders. To enable client side binary sorting order, set FormatOptions.SortLocale to 0.
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3