How to disable Autocommit in Firedac

Asked

Viewed 692 times

1

How would it be to disable Autocommit type:

FDTable1.AutoCommit := False;

or

FDconection.AutoCommit := False;

I don’t think so.

2 answers

3

I think it’s worth noting that the option AutoCommit simply clears the Updatstatus of the records. Other than ApplyUpdates of ClientDataSet, that returned all records to usUnModified automatically, the FDQuery keeps them. I imagine it’s so that we can, after giving a ApplyUpdates, make new changes to the database according to the status of the record.

So if you run ApplyUpdates in a row (due to some automation, for example), you may get a primary key error among others due to the attempt to run the same operation twice.

3


You can do it this way:

FDConnection1.TxOptions.AutoCommit := False;
  • 1

    I’ll try here to make sure you’re okay...

  • 1

    It solved the problem and got pretty fast to record.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.