Issue with transactions during update

(tobygroves) #1

I’m having a strange issue with transactions. I’m using Delphi 10.2.3 with FireDAC against an MSSQL database.

I have a delta which I’m applying with an ApplyUpdates call. Obviously all of the delta/change processing on the server takes places within a transaction. This is fine.

However, whilst processing this update, my business processors may need to execute a schema command. This command is executed within the context of the service instance (by assigning the TDALocalCommand’s ServiceInstance property) so that it would operate within the context of the existing service instance and its transaction.

What appears to be happening is that this call is totally screwing up the transaction as it’s wrapped in a begin/commit pair. Tracing it in SQL profiler, it appears this commits the “main” transaction and the remaining changes are then processed outside of the transaction.

Can you confirm what’s going on here? Surely the command should simply execute within the context of the existing transaction, not attempt to start it again and then commit it.

(antonk) #3

Yes, this looks like a bug. Our Delphi guru will investigate this once he’s back from holidays.

(RemObjects) #4

Thanks, logged as bugs://81612

(EvgenyK) #5


can you create a simple testcase that reproduces this issue, pls?
you can send it directly to support@

another solution - you can use OnUpdateDataBeginTransaction/OnUpdateDataCommitTransaction/OnUpdateDataRollBackTransaction events and set aUseDefaultTransactionLogic to false when custom schema command is executed via TDALocalCommand.