Subject Some errors when using implicit transactions
Author Daniel Rail
Hi,

I'm currently using Delphi 7 and the latest IBO 5.

I have customers that are encountering an exception in areas of the
application where it is using implicit transactions with AutoCommit :=
True.

The exception message is "Activate has already been called.". I do
notice that it is raised in the TIB_Transaction.Activate method.


Here's the callstack:

00fe581a ibo5crt_d7.bpl Ib_components TIB_Transaction.Activate
01007b15 ibo5crt_d7.bpl Ib_components TIB_BDataset.SysPost
0154b225 ibo5xrt_d7.bpl Ibodataset TIBOInternalDataset.SysPost
00fff592 ibo5crt_d7.bpl Ib_components TIB_Dataset.Post
01546310 ibo5xrt_d7.bpl Ibodataset TIBODataset.InternalPost
4034f161 dbrtl70.bpl Db TDataSet.CheckOperation
4034ec8f dbrtl70.bpl Db TDataSet.Post
01542b3a ibo5xrt_d7.bpl Ibodataset TIBODataset.Post
0154b245 ibo5xrt_d7.bpl Ibodataset TIBOInternalDataset.SysPost
00fe5cd9 ibo5crt_d7.bpl Ib_components TIB_Transaction.SysProcessCommitAction
00fe6146 ibo5crt_d7.bpl Ib_components TIB_Transaction.SysCommitBegin
00fe6cd7 ibo5crt_d7.bpl Ib_components TIB_Transaction.SetTransactionState
00fe584b ibo5crt_d7.bpl Ib_components TIB_Transaction.Activate
01007b15 ibo5crt_d7.bpl Ib_components TIB_BDataset.SysPost
0154b225 ibo5xrt_d7.bpl Ibodataset TIBOInternalDataset.SysPost
00fff592 ibo5crt_d7.bpl Ib_components TIB_Dataset.Post
01546310 ibo5xrt_d7.bpl Ibodataset TIBODataset.InternalPost
4034f161 dbrtl70.bpl Db TDataSet.CheckOperation
4034ec8f dbrtl70.bpl Db TDataSet.Post
01542b3a ibo5xrt_d7.bpl Ibodataset TIBODataset.Post
160eba80 SLibCMS1500ClaimForm.spi SLibCMS1500ClaimForm_CMS1500ClaimFormFRM 876 TCMS1500ClaimFormFRM.SaveExecute

The last line in the callstack corresponds to a TIBOQuery.Post

I checked the code in IBO 4, just to compare both versions of the
TIB_Transaction.Activate method, and I noticed that the raising of
that exception("Activate has already been called.") is new in IBO 5.
What would be the consequence of changing the code to simply skip the
code(in the Activate method) if FActivateIsHappening = True ?

One thing that I'm noticing in the callstack is that the
TIBODataset.Post method is called twice and the
TIBODataset.InternalPost method is called three times.

The exception is not raised everytime, but my customers are reporting
it in different areas of our applications, and it's never consistent.
I noticed that if I change from implicit to explicit transaction
handling, the error goes away. But, having to make changes in over
500 forms, is not the best solution at the moment.

Any help is appreciated.

Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)