clear IndexFieldNames for a new Open

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
easyblue
Posts: 64
Joined: Wed 02 Feb 2005 13:02
Location: Shanghai

clear IndexFieldNames for a new Open

Post by easyblue » Tue 17 Aug 2010 08:17

Hello

[problem]:
When combine OraQuery and CRDBGrid, I found that if for CRDBGrid, I have enabled "LocalSorting" for performance, then in following cases:

1. I click on the grid title to sort the result
2. I use the same OraQuery to open a new query, whose result contain no previous sorted field

there will be an error due to missing of the sorting field.

Checking source code, found that
OraQuery->IndexfieldNames has been changed by CRGrid, and remain the same value for the new query.

[Temp Solution]:
need a manual reset of

Code: Select all

                   OraQuery->IndexFieldNames="";
before opening a new one.

[Question]:
1. can such IndexFieldNames be automatically reset upon new query if its SQL has been changed?
2. will also "LocalFilter" of CRDBGrid, who changes OraQuery->FilterSQL also need such a verification?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 18 Aug 2010 10:24

hello,

We can't change this behaviour, because other our users need IndexFieldNames to keep its value after reopening the query or changing its SQL text. For example:

Code: Select all

OraQuery.IndexFieldNames:= 'FIELD1';
OraQuery.SQL.Text := 'SELECT 1 AS FIELD1 FROM DUAL'; <-- if IndexFieldNames are reset, as you want, users will not get the expected behaviour
OraQuery.Open;
If you changed this property and then changed query text, it is necessary to reset this property manually.

You can reset needed attributes in the AfterClose Event.

easyblue
Posts: 64
Joined: Wed 02 Feb 2005 13:02
Location: Shanghai

Post by easyblue » Thu 19 Aug 2010 00:36

Hello

Or maybe an enhancement of documentation of TCRDBGrid for its filtering and sorting features, so user can easily found out this manual solution?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 19 Aug 2010 07:46

Hello,

Thanks, we will add this information to our documentation.

Post Reply