Subject | [IBO] Re: support for 2 transactions in ib_query |
---|---|
Author | Mihai Chezan |
Post date | 2004-07-06T01:31:20Z |
> I just looked at my current app - when I refresh, the monitor showsI've made a little test demo.
> the number of records retrieved is 1 more than the number of visible
> rows in the grid. It calls the first row twice for some reason but >
> the table has 1000s of records and the valid query has at least 2000
> rows in it. Do you have AutoFetchAll set to true by any chance?
> Alan
I don't have AutoFetchAll set to true.
http://f1.grp.yahoofs
com/v1/kPnpQDalVR3znLZ-nC136HYYg7RahjrbEw_7BvEob3wEaxeLAw_KYz6wFHEGdPJ
WvLneJ2eiEX9R13R2Vuvmfqdb/IB_TestRefresh.zip
By paying around with the test demo I found out is this:
quote from ibo help TIB_DatasetRefresh:
"For the IB_Query it is done in a manner that preserves all rows that
have been selected previously and fetches in only the key columns."
Not always true. If you have FetchWholeRows set to true it will fetch
whole rows not only the key. I think the heplp is not updated
correctly because if you look RefreshKeys:
"This method will refresh just the keys of the dataset in order to
pick up or drop inserted or deleted rows for the dataset.
FetchWholeRows must be false or else this method will simply act the
same as the Refresh method because when it is True, whole rows are
being fetched rather than just the keys independently from their
associated record buffers."
And in Tutorial2 there is a line:
{ FetchWholeRows tells the Query to act more like the VCL queries.
However, if you set this to TRUE, then you may lose some of the
excellent Client/Server performance gains that IBO gives you. It also
has to be set to TRUE in a few other specific circumstances. }
FetchWholeRows := False; // Default = FALSE
But in my case if I put an IB_Query on the form FetchWholeRows is True
by default.
And what is more confusing is that the above comment suggests that
setting it to False is the rule and setting it to True is the
exception. But if you read the help:
"Normally, it is better to leave FetchWholeRows set to True so that IB
can batch rows together in a packet for more efficient transmission
across the wire."
Anyway, the bottom line is that for Refresh to get only the key colums
from the server you have to set FetchWholeRows := False.
But even so, ibo will fetch the key columns from record 1 to record
500 (if you set FetchWholeRows := False in my test demo) and not only
the key columns that are visible in grid (rows 496-500).