Subject | Re: [IBO] coding question |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-02-02T05:52:15Z |
At 07:00 PM 01-02-02 -0800, Daniel Bertin wrote:
Autocommit upon post will always work if the transaction is not under explicit control. If you call StartTransaction to start the transaction, autocommit becomes suspended until the transaction is resolved, and you must call Commit or CommitRetaining yourself.
Of course, if you do have Autocommit true and you call Post, the transaction will only be committed if there is no error to prevent it committing. Make sure that you are trapping errors, not swallowing them with Abort, otherwise you won't have any means to resolve the uncommitted transaction. (Sometimes people wrongly think that, if a Commit fails, the transaction is automatically rolled back....)
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at www.ibobjects.com
>Hi all,In general, calling Commit or Rollback on a transaction that that has not been physically started will cause an error. However, Jason uses CommitRetaining for autocommit, which reopens a transaction for the same database cursor(s) so that error is pre-empted.
>
>I learned the other day that post <> commit (thanks Helen)
>
>if I have a IBODatabase set to Autocommit = true and I post a record
>
>datamodule.IBOtable.post
>
>is the command datamodule.IBODatabase1.commit needed? if used does assure
>the write to the table or does it only trigger the commit that would of
>happen anyways?
Autocommit upon post will always work if the transaction is not under explicit control. If you call StartTransaction to start the transaction, autocommit becomes suspended until the transaction is resolved, and you must call Commit or CommitRetaining yourself.
Of course, if you do have Autocommit true and you call Post, the transaction will only be committed if there is no error to prevent it committing. Make sure that you are trapping errors, not swallowing them with Abort, otherwise you won't have any means to resolve the uncommitted transaction. (Sometimes people wrongly think that, if a Commit fails, the transaction is automatically rolled back....)
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at www.ibobjects.com