AfterFetch handler being called too early / usage of NonBlocking mode / run code when loading of all records is finished

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by AlexP » Tue 02 Feb 2016 12:17

The AfterFetch event may occur several times in case if you haven't disabled the FetchAll option. When the event triggers and FetchAll is enabled, ALL the data will be present in the dataset.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by pcz » Mon 08 Feb 2016 11:30

AlexP wrote:The AfterFetch event may occur several times in case if you haven't disabled the FetchAll option. When the event triggers and FetchAll is enabled, ALL the data will be present in the dataset.
Ok
According to this information there is a reproducible bug in TOraQuery class

1. Set properties of TOraQuery instance
FetchAll := True;
NonBlocking := True;

2. Call "Open" method

3. DataSet content inside AfterFetch event behaves different depending on number of returned rows
Problem happens when value of FetchRows property is higher than record count
(OraQuery1.FetchRows < OraQuery.RecordCount)

Image

I have sent example with source code at Your mailbox

Regards
P.C.
Last edited by pcz on Thu 11 Feb 2016 08:05, edited 1 time in total.

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

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by AlexP » Tue 09 Feb 2016 09:55

Unfortunately, we haven't received your demo project. Please send it again to alexp*devart*com

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by pcz » Wed 10 Feb 2016 11:17

Mail has been sent :)

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

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by AlexP » Wed 10 Feb 2016 12:19

Thank you. We have received your sample. We will try to respond as soon as possible.

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

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by AlexP » Thu 11 Feb 2016 07:46

Thank you for the sample, we have reproduced the described problem and will investigate the reason for such behavior.

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

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by AlexP » Fri 12 Feb 2016 13:05

We have already fixed the problem, this fix will be added to the next ODAC version.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by pcz » Fri 12 Feb 2016 13:38

Ok
Thank You very much for attention :)

So I just should use code like

Code: Select all

procedure TForm1.OraQuery1AfterFetch(DataSet: TCustomDADataSet);
begin
  if not DataSet.Fetching then
    DoSomething;
end;
...and just wait a while for next ODAC release? :P

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

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by AlexP » Tue 16 Feb 2016 10:14

Yes. You will be able to use this code.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by pcz » Fri 04 Mar 2016 10:12

Just a new extra discovery

Same problem happens every time after calling <TOraQuery>.Refresh regardless number of fetched records...

Cause may be the same ;)

[Waiting for new release.... :roll: :roll: :roll: ]

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

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by AlexP » Fri 04 Mar 2016 10:45

Behavior on using the Refresh method is also fixed.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by pcz » Tue 05 Apr 2016 11:12

....any signs of upcoming release?
[ Just asking :) ]

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by pcz » Tue 26 Apr 2016 12:40

Problem still happens in 9.7.23 - just looks different :(

Flag "Fetched" is now set but there is still no access to data when Query returns less records than FetchRows property value (record count < FetchRows)

Image

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

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by AlexP » Tue 26 Apr 2016 12:47

Try to reproduce the issue using the standard component: DBGrid. And let us know the result.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched

Post by pcz » Tue 26 Apr 2016 13:02

AlexP wrote:Try to reproduce the issue using the standard component: DBGrid. And let us know the result.
Screenshots I attached are made with ordinary TDBGrid
It's not a matter of grid - It happens every time with or without grid

It is not about any visual component - it's a internal problem of TOraQuery class
There is just no data accessible in <TOraQuery>.AfterFetch handler
What I mean is DataSet fields just have no value

Post Reply