Hi!
I notice that TZTransaction.Commit does not move Olders/Next transaction counters in FB3.
But TZConnection.Commit - does.
How I notice that.
I write SQL query and fetch it one per 10 seconds in cycle (by timer)
ZTransaction1.AutoCommit:=false;
if not ZTransaction1.Active then
ZTransaction1.StartTransaction;
ZQuery1.Open; { Any SELECT }
if not (ZQuery.EOF and ZQuery.BOF) then sleep(1);
ZQuery1.Close;
if ZTransaction1.Active then
ZTransaction1.Commit;
Attention: last command "Commit" - does not move FB transaction counters and every next cycle I notice new record in MON$TRANSACTIONS table.
But if I change last condition to
if ZTransaction1.Active then
begin
ZTransaction1.Commit;
ZTransaction1.Connection.Commit;
end
What's the matter?
Diff:
Hello,
Just Firebird transaction counters count started transactions - not committed ones. I assume that TZTransaction.Commit will only commit the current transaction and not start a new one. Whereas TZConnection.Commit will commit the current transaction and start a new transaction immediately. This newly started transaction will then increase the transaction counter.
Best regards,
Jan
Hmm... What will be the result if the transaction does not move the counters:
Transaction1.Commit
Transaction2.Commit
Connection.Rollback
?
I am not sure, what you are going at and I hate to try to guess what other people do or think.
It really all depends on what counter you look. So if there is a need to discuss things please describe the exact setup you are using and at which point you look at which transaction counter.
So - basically the "Next Transaction" number should increase whenever a transaction is Started. Commits and Rollbacks shouldn't touch this number.
The "Oldes Active" Can move when Commit or Rollback are called. But it doesn't need to.
So in most cases it doesn't make sense to look at the transaction counters when you do Commits or Rollbacks because they very well might be the transactions in the middle that dont touch the OAT.
Note: Also have a look at https://www.ibphoenix.com/resources/documents/general/doc_67