When they sold the POWER of Firedac by seeing the image of being able to reconnect to the database (without losing the data) it was a miracle...
But they didn’t tell the Post that we would face for those coming from DBX...
It was rough, but you can handle it like this;
Transaction1 := Tfdtransaction.Create(nil);
Transaction1.Connection := Tdtmdl(Dtmdl). Sqlcnctnbancodate;
Transaction1.Options.Autocommit := False;
Transaction1.Options.Disconnectaction := xdRollback;
Transaction2 := Tfdtransaction.Create(nil);
Transaction2.Connection := Tdtmdl(Dtmdl). Sqlcnctnbancodate;
Transaction2.Options.Autocommit := False;
Transaction2.Options.Disconnectaction := xdRollback;
SQL1 := Tfdquery.Create(nil);
SQL1.Connection := Tdtmdl(Dtmdl). Sqlcnctnbancodate;
SQL1.Connection.Txoptions.Autocommit := False;
SQL1.Transaction := Transaction1;
SQL2 := Tfdquery.Create(nil);
SQL2.Connection := Tdtmdl(Dtmdl). Sqlcnctnbancodate;
SQL2.Connection.Txoptions.Autocommit := False;
SQL2.Transaction := Transaction2;
Try
if Transaction1.Active = False then
Transaction1.Starttransaction;
if Transaction2.Active = False then
Transaction2.Starttransaction;
Transaction1.commit;
Transaction2.commit;
except
Transaction1.rollback;
Transaction2.rollback;
end;
Obs.
All SQL run in SQL1 will be handled in transaction1
All SQL run in SQL2, will be handled in teansaction2
I hope I helped;
[] s
Official documentation with resolution: http://docwiki.embarcadero.com/RADStudio/Berlin/en/Managing_Transactions_(Firedac)
– André Angelucci