Subject | Re: [IBO] Doubt with auto commit |
---|---|
Author | Jason Wharton |
Post date | 2010-09-19T18:57:14Z |
Andrei,
Hans is referring to the feature when you as the programmer call
StartTransaction and initiate what I call an explicit transaction. When you
do this, the normal behavior of automatically committing (via commitretain)
your changes is suspended and your changes are allowed to all be part of the
transaction you started. In order for things to go back to normal, you call
Commit, CommitRetaining, Rollback or RollbackRetaining. Then, your explicit
transaction is ended and you are back to AutoCommit mode (depending on what
your setting for AutoCommit is).
If you set AutoCommit to false then you do not have to explicitly start a
transaction. IBO will not perform a commit of your changes and they just
pile up waiting for you to do a Commit, etc. Once something is posted to the
server the transaction becomes what I call activated. Your transaction's
status will then tell you it is Active. If nothing has been posted your
transaction is considered inactive.
The transaction itself will show up as Started = true when you merely fetch
some data from the server so if you are concerned about making sure the
transaction is closed then you need to pay attention to the property which
examines the physical transaction handle. If you are using the isolation of
tiConcurrency then you are responsible to call Commit, etc. when you want
that transaction handle to go away. This is because you said you want a
snapshot view of the data and IBO is not going to do anything to call Commit
because that would end your snapshot and force you to get a new snapshot
when you started a new transaction.
So, be very mindful when it comes to transaction related things. IBO is very
rich in its ability to give you complete control over everything and it
takes a little bit of learning to harness it all.
When in doubt, this is the place to come.
Thanks,
Jason Wharton
Hans is referring to the feature when you as the programmer call
StartTransaction and initiate what I call an explicit transaction. When you
do this, the normal behavior of automatically committing (via commitretain)
your changes is suspended and your changes are allowed to all be part of the
transaction you started. In order for things to go back to normal, you call
Commit, CommitRetaining, Rollback or RollbackRetaining. Then, your explicit
transaction is ended and you are back to AutoCommit mode (depending on what
your setting for AutoCommit is).
If you set AutoCommit to false then you do not have to explicitly start a
transaction. IBO will not perform a commit of your changes and they just
pile up waiting for you to do a Commit, etc. Once something is posted to the
server the transaction becomes what I call activated. Your transaction's
status will then tell you it is Active. If nothing has been posted your
transaction is considered inactive.
The transaction itself will show up as Started = true when you merely fetch
some data from the server so if you are concerned about making sure the
transaction is closed then you need to pay attention to the property which
examines the physical transaction handle. If you are using the isolation of
tiConcurrency then you are responsible to call Commit, etc. when you want
that transaction handle to go away. This is because you said you want a
snapshot view of the data and IBO is not going to do anything to call Commit
because that would end your snapshot and force you to get a new snapshot
when you started a new transaction.
So, be very mindful when it comes to transaction related things. IBO is very
rich in its ability to give you complete control over everything and it
takes a little bit of learning to harness it all.
When in doubt, this is the place to come.
Thanks,
Jason Wharton
----- Original Message -----
From: "Hans" <hhoogstraat@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, August 26, 2010 10:00 PM
Subject: Re: [IBO] Doubt with auto commit
> Just issue a ib_connection,starttransaction
> before any other posting actionsand the
> autocommit is cancelled.
>
> ----- Original Message -----
> From: "Andrei Luís" <compuvale.software@...>
> To: <ibobjects@yahoogroups.com>
> Sent: Thursday, August 26, 2010 8:51 PM
> Subject: [IBO] Doubt with auto commit
>
>
>> Hi, where and how do I turn off auto commit?
>>
>> I'm experiencing the following behavior:
>>
>> IBO 4.9.9 + FB 2.1 + Delphi 2006 + Win 7 HP
>>
>> uDM I have ib_connection -> ib_querys -> ib_datasources
>> uPrincipal calls uCustomer
>>
>> in uCustomer I have buttons for Insert, Delete, Alter, etc..., and
>> several ibo controls
>> If I do a dm.qrCustomer.Insert, and close the form, the row is posted
>> (in form.onClose I close dm.qrCustomer)
>> If I exit the application, the row is posted too.
>>
>> I'm sure this is about auto-commit, but please note that I have no
>> ib_transaction explicit in DM, I always use
>> ib_query.ib_transaction.commitretaining or rollbackretaining.
>>
>> Is there any way I can turn auto-commit off maintaining this scenario
>> with no ib_transaction object explicit dropped in DM?
>>
>> []s
>> Andrei