Subject CommitAction and automatic AOT advancement
Author Stephen Boyd
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?