Mix explicit transactions and autocommit

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
michaschumann
Posts: 44
Joined: Fri 14 Nov 2014 15:26

Mix explicit transactions and autocommit

Post by michaschumann » Tue 05 Jan 2016 11:03

Is it possible to mix these two modes like it is possible in .net c# by supplying a transaction handle or not? I usually only use transactions where i need it, as many actions are only doing one single activity that either succeeds or fails...

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Mix explicit transactions and autocommit

Post by azyk » Fri 15 Jan 2016 08:56

Please specify the database you are working with.

michaschumann
Posts: 44
Joined: Fri 14 Nov 2014 15:26

Re: Mix explicit transactions and autocommit

Post by michaschumann » Fri 15 Jan 2016 22:50

I am using firebird. Also I want to use ibdac in the future.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Mix explicit transactions and autocommit

Post by ViktorV » Tue 19 Jan 2016 16:32

There is an AutoCommit property of connection and of datasets. The AutoCommit property of connection is designed for ability to disable the AutoCommit property of all the datasets. Then if TUniConnection.AutoCommit is set to False, all the transactions may be committed only explicitly (not depending on the dataset's AutoCommit property value). See more details about this in UniDAC help: https://www.devart.com/unidac/docs/ibprov_article.htm
If the connection's AutoCommit property is enabled, the dataset's AutoCommit allows to manage how the dataset commits a transaction. If the AutoCommit property of the dataset is set to True - a transaction will be committed after each modification (even if it is started explicitly). If False - the transaction won't be committed, it must be committed explicitly.
You can't mix both modes within a single dataset. You can disable AutoCommit for particular datasets and control transactions for them explicitly.

Post Reply