Sort Descending in TFDTable Duplicates Rows

When using TFDTable in LDW mode, descending fields result in duplicate rows. For instance:

TFDTable.TableName is set to a VIEW name (not a tablename)

TFDTable.UpdateOptions.KeyFields is set to the primary key in the VIEW base table.

TFDTable.IndexFieldNames is set to 'PERS_NAME:A'.

shows the correct result set without any duplicates. If I change IndexFieldnames to 'PERS_NAME: D' , each record returned by the view is displayed two or three times.

How to avoid duplicates? This only happens when sorting the table in descending order, no matter which field I use to sort.

UPDATE: You can find an example project for reproducing the problem on github: https://github.com/cytrinox/firedac-sort-issue or download the project via https://github.com/cytrinox/firedac-sort-issue/archive/ master.zip

+4
source share
3 answers

This problem will persist until we get other ways to handle TFDTable in LDW mode.

LDW Definition - XE6

Using LDW with indexes based on anything other than numeric (i.e. integers) will lead you to all kinds of problems - if you don't obey the rules.

I also spend hours trying to get LDW to work with indexed VARCHAR fields, but using my SQL statement using COLLATE (or matching the character set of this field directly) will make my application useless. This means that it will crash with the same error that you described.

Here is the information I received from the author of FireDAC.

1001 LDW - .    . IOW,    TFDTable , ,    . :

  • , , FireDAC, . - .
  • - TFDTable TFDTable.

, TFDTable .

, LDW . - .

- TFDQuery TFDTable. LDW TFDQuery, .

, .

+2

FireDAC PostgreSQL. TFDTable, .

, , , SQL:

CREATE VIEW my_view AS 
SELECT * FROM my_table;

my_view TFDTable.TableName. .

0

, , - .

string.

:

FDConnection.FormatOptions.SortLocale: = 0;

Regards

0
source

Source: https://habr.com/ru/post/1568870/


All Articles