What are the atomic transaction methods in Delphi?

0

I worked with ASP.net MVC a lot on the front end, whenever I was debugging I came across methods like: transact , commit and rollback .

When I talked to a former co-worker who programmed Delphi I came across a question that knew the answer in concept, but I lacked the key words to help you. it. I explained the concept of atomicity to him, but I could not find any method in that language that could do the same as the methods mentioned in the first paragraph.

    
asked by anonymous 31.05.2017 / 16:37

2 answers

0

First: You need to specify your question better. Which data access component and which version of Delphi you are using.

Second: There is no solution like Entity for Delphi. Here you use connection components in conjunction with the data access and manipulation components. Currently, Firedac (Delphi Seattle) has been used mainly as a data access platform.

Third: Delphi has no built-in dependency injection mechanisms. And each component does the transaction control in a different way. In FireDac you can do an FDConnection.StarTransaction and FDConnection.Commit or FDConnection.Rollback. Or you can use the Transaction of the data access component itself (TFDQuery.Transaction).

Anyway, be more specific so we can help you better.

    
15.06.2017 / 23:54
-1

Actually no programming language is Atomic. A process may or may not be atomic. Atomic means: either does everything or does nothing. In database this concept is well implemented in practice. In Delphi there are database access components (DBExpress for example) that have transaction, commit, rollback, etc.

DBExpress has a TSQLConnection class, add it to your form. In your code the methods of the class will be available for use. Example:

SQLConnection1.StartTransaction (); SQLConnection1.Commit (); SQLConnection1.RollbackFreeAndNil ();

    
31.05.2017 / 16:50