Page 1 of 1

UniDAC Connection Autocommit False not working

Posted: Tue 16 Feb 2016 00:02
by mirkocutri
Hi.
I work with this settings:
UniConnection.AutoCommit = false
UniQuery.Connection = UniConnection
UniQuery.Transaction = <default> (no specific UniTransaction in this application)
UniQuery.DefaultCloseAction = taRollback (don't think this matters here)

When I edit a value and scroll to next or prior with a navigator row without posting, the database is still updated. How can I avoid this behaviour? On scrolling without posting changes should not be posted or give a message to post or discard changes.

Thanks a lot for your help
M.

Re: UniDAC Connection Autocommit False not working

Posted: Tue 16 Feb 2016 08:04
by azyk
Please specify the database you are working with.

Re: UniDAC Connection Autocommit False not working

Posted: Tue 16 Feb 2016 22:12
by mirkocutri
Ups, sorry... MySQL

:)

Re: UniDAC Connection Autocommit False not working

Posted: Wed 17 Feb 2016 11:39
by ViktorV
Working with MySQL server, the TUniConnection.AutoCommit property is not used. If you change data (e.g., insert, update, delete), it is always saved in a database automatically on calling the Post method, unless you use transactions. When using DB controls, if the dataset is in the edit mode, on navigating through records, the Post method is automatically executed. To commit or cancel changes, you can use the BeforePost event handler. For example:

Code: Select all

procedure TForm1.UniQueryBeforePost(DataSet: TDataSet);
begin
  if (MessageDlg('Save changes?', mtConfirmation, [mbOk, mbCancel], 0) = mrCancel) then
    DataSet.Cancel;
end;

Re: UniDAC Connection Autocommit False not working

Posted: Thu 18 Feb 2016 07:05
by mirkocutri
It's working fine now.... thank you very much for the tipp about MySQL behaviour on AutoCommit :D

Re: UniDAC Connection Autocommit False not working

Posted: Thu 18 Feb 2016 14:17
by ViktorV
It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about IBDAC.