Subject Re: CommitAction and automatic AOT advancement
Author Svein Erling Tysvær
OK, Stephen, here's a guess (note, I'm guessing, in this area I'm far
from an expert).

A unidirectional query can - as far as I understand - best be
implemented as a TIB_Cursor. These do not need to be closed, reaching
EOF "implies" close.

Hence, I guess that CursorIsOpen implies that EOF hasn't been reached,
something which is a good reason for not committing.

I don't use TIBOQuery myself (I think that I don't even have it
installed), but with a TIB_Query I'd expect setting AutoFetchAll
and/or ReadOnly could have helped you.

HTH,
Set

--- In IBObjects@yahoogroups.com, "Stephen Boyd" wrote:
>
> I am trying very hard to understand the relationship between
> CommitAction and automatic OAT advancement. I thought I had it
> figured out but I have come across a situation where it doesn't work
> the way I thought it did. I am using TIBOQuery with TIB_Connection
> and TIB_Transactions components.
>
> The strategy that I have adopted is to set CommitAction to caClose
> for all queries that are used to look up values and to set
> CommitAction to caFetchAll for all queries that drive DBGrids.
> Lookup queries have Unidirectional set to True. I have set the
> TimeoutProps as follows:
>
> AllowCheckOAT = 10
> Attempt = 5
> AttemptMaxRow = 1000
> AttemptRetry = 1
> AttemptTicks = 250
>
> In most situations this appears to work the way I expect. That is
> caClose queries are close, caFetchAll queries are fetched to EOF and
> the transaction is commited. But I have 1 query where this doesn't
> seem to work so I started digging around with the debugger and
> discovered that queries with Unidirectional = True and do not get
> forced closed. In TIB_Transaction.SysTimeoutAttempt we have the
> following code:
>
> CanAttemptCommit := true;
> for ii := 0 to DatasetCount - 1 do
> with Datasets[ ii ] do
> begin
> if CursorIsOpen then
> ---------------->
> if Unidirectional or Fetching {or ( BufferRowCount > 1000 )}
> then
> begin
> CanAttemptCommit := false;
> Break;
> end
> <-----------------
> CanAttemptCommit := true;
> for ii := 0 to DatasetCount - 1 do
> with Datasets[ ii ] do
> begin
> if CursorIsOpen then
> if Unidirectional or Fetching {or ( BufferRowCount > 1000 )}
> then
> begin
> CanAttemptCommit := false;
> Break;
> end
>
> Why do Unidirectional queries not get forced closed? If CommitAction =
> caClose then isn't that an indication that I don't care about the
> content of this query? What do I have to do the get the OAT to
> advance in this situation?