AfterFetch handler being called too early / usage of NonBlocking mode / run code when loading of all records is finished
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
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.
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
OkAlexP 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.
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)

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.
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
Unfortunately, we haven't received your demo project. Please send it again to alexp*devart*com
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
Thank you. We have received your sample. We will try to respond as soon as possible.
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
Thank you for the sample, we have reproduced the described problem and will investigate the reason for such behavior.
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
We have already fixed the problem, this fix will be added to the next ODAC version.
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
Ok
Thank You very much for attention
So I just should use code like
...and just wait a while for next ODAC release? 
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;

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
Yes. You will be able to use this code.
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
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....
]
Same problem happens every time after calling <TOraQuery>.Refresh regardless number of fetched records...
Cause may be the same

[Waiting for new release....



Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
Behavior on using the Refresh method is also fixed.
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
....any signs of upcoming release?
[ Just asking
]
[ Just asking

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
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)


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)

Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
Try to reproduce the issue using the standard component: DBGrid. And let us know the result.
Re: Proper usage of NonBlocking query mode / fire code when all records are fetched
Screenshots I attached are made with ordinary TDBGridAlexP wrote:Try to reproduce the issue using the standard component: DBGrid. And let us know the result.
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