Multiple transactions with FireDAC?

0

I would like to work with multiple concurrent transactions in FireDAC , making different decisions and commits ) for each. It's possible? I currently work as follows:

try
  obj_TFDConnection.StartTransaction();
  ...
  obj_TFDConnection.Commit();
except
  obj_TFDConnection.Rollback();
end;

However, I can only manage one transaction at a time.

    
asked by anonymous 08.03.2017 / 18:43

1 answer

0

Friend the FireDAC transaction is conceptually different from the DBX transaction. It turns out that both work with multi transactions; What I mean is that in practice you can open a transaction, make some kind of change in the bank, open another transaction, make new changes, and so on. The bottom line is that we have a big difference between FireDAC and DBX in the way this is seen. Then it directly implies how you work. Let's see:

We take two tables as an example, and we will have to do an action, which consists of making an insert in each table, if both are executed without problems is commit and return "OK" for the main function.

In DBX we will realize that the second transaction has no relation to the first. I'm if you commit in the first and rollback in the second will be in the end we will have only one insertion;

Now in FireDAC the same situation. If we commit in the first and rollback in the second, both transactions will be rolled back; It's as if the first one rules everything.

This is a huge difference if you are thinking of migrating;

    
26.05.2017 / 19:36