Error with Queries with Order by Clause using MIDAS and persistent fields

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Andew
Posts: 4
Joined: Tue 12 Apr 2005 08:57

Error with Queries with Order by Clause using MIDAS and persistent fields

Post by Andew » Tue 12 Apr 2005 09:20

I am getting problems with queries returning an incorrect order when using an Order by Clause. A problem that did not exist when using the BDE.

The problem is with ODAC queries that

1. Have persistent fields
2. some of these fields have the pfInKey included in ProviderFlags
3. Are used via MIDAS and a dataset Provider
4. Compiled using Delphi 5.


The reason for this is that TOraQuery does not seem to implement the function PSGetDefaultOrder which the provider uses to get records in the required order.

We have fixed the problem by creating a ToraQuery descendant class, but I would rather this was fixed in the standard Toraquery to avoid conflicts in the future.

Can anyone confirm the problem and give estimates for when a fix could be distributed.

Thanks

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 13 Apr 2005 08:30

We will include this functionality in the next ODAC build.

Guest

Post by Guest » Fri 15 Apr 2005 08:43

Thanks Alex for your quick response and resolution.

I'll look forward to the new build :D

Andrew

Andew
Posts: 4
Joined: Tue 12 Apr 2005 08:57

RE: Toraquery order by clause problem when using MIDAS & persistent fields

Post by Andew » Mon 06 Jun 2005 09:25

To the Corlelab team,

Can you confirm that the problem I had identified has been fixed in version 5.55

Thanks

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 08 Jun 2005 06:06

Yes, we have included this feature in ODAC 5.50.1.18. If you encounter any problem with it pls. inform us.

Guest

Post by Guest » Tue 18 Oct 2005 17:24

Alex wrote:Yes, we have included this feature in ODAC 5.50.1.18. If you encounter any problem with it pls. inform us.
Still it has a problem: When the ordinance field is a function, the OraProvider does not classify correctly.

Example:

Code: Select all

SELECT AnyDate, AnyType, AnyNumber 
  FROM AnyTable
  ORDER BY Trunc(AnyDate), AnyType

The OraProvider classifies only for the AnyType field.

F.Silva

Error with Queries with Order by Clause using MIDAS - **** FIXED ****

Post by F.Silva » Tue 18 Oct 2005 18:59

Anonymous wrote:
Alex wrote:Yes, we have included this feature in ODAC 5.50.1.18. If you encounter any problem with it pls. inform us.
Still it has a problem: When the ordinance field is a function, the OraProvider does not classify correctly.

Example:

Code: Select all

SELECT AnyDate, AnyType, AnyNumber 
  FROM AnyTable
  ORDER BY Trunc(AnyDate), AnyType

The OraProvider classifies only for the AnyType field.

Already I solved the problem. The error is in the TOraDataSet.PSGetDefaultOrder function in Ora.pas unit.

The corrected function is of the following form:

Code: Select all

function TOraDataSet.PSGetDefaultOrder: TIndexDef;
  ....
  ....

begin
  if FKeyFields = '' then     {  Fix }
    Result := inherited PSGetDefaultOrder
  else    { Fix }
    begin
      if not Assigned(Result) then
        if Trim(IndexFieldNames)  '' then
          Result := GetIndexForIdxNames
        else
          Result := GetIndexForOrderBy(GetFinalSQL, Self);
    end;
end;

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Thu 20 Oct 2005 13:46

Thank you for support.
We will include such fix in then next ODAC build.

Andew
Posts: 4
Joined: Tue 12 Apr 2005 08:57

Problem reintroduced

Post by Andew » Thu 01 Jun 2006 14:38

In april 2005 I posted a problem with ToraQuery Component and queries using the the Order By Clause when used via MIDAS

The problem was fixed in versin 5.50.18 but seems to have been reintroduced sometime between then and the release of 5.7

I have looked at the difference between the source files and the following lines of code appear to be different for the TOraDataSet.PSGetDefaultOrder function in the Ora.pas unit

VERSION 5.55.18

Result := inherited PSGetDefaultOrder;
if not Assigned(Result) then
if Trim(IndexFieldNames) '' then
Result := GetIndexForIdxNames
else
Result := GetIndexForOrderBy(GetFinalSQL, Self);

VERSION 5.7

if FKeyFields = '' then
Result := inherited PSGetDefaultOrder
else
if Trim(IndexFieldNames) '' then
Result := GetIndexForIdxNames
else
Result := GetIndexForOrderBy(GetFinalSQL, Self);


Can someone confirm that this is a problem and that it will be resolved in a future build.

Thanks in advance.

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Mon 05 Jun 2006 07:57

We cannot reproduce the problem. Please send to ODAC support address complete sample that
demonstrates the problem and include script to create server objects.

Post Reply