Page 1 of 1

Mix explicit transactions and autocommit

Posted: Tue 05 Jan 2016 11:03
by michaschumann
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...

Re: Mix explicit transactions and autocommit

Posted: Fri 15 Jan 2016 08:56
by azyk
Please specify the database you are working with.

Re: Mix explicit transactions and autocommit

Posted: Fri 15 Jan 2016 22:50
by michaschumann
I am using firebird. Also I want to use ibdac in the future.

Re: Mix explicit transactions and autocommit

Posted: Tue 19 Jan 2016 16:32
by ViktorV
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.