Hi,
What is the preferable way to write Delphi database applications using transactions and also data-aware components?
I have to write a client app that access InnoDB tables, and do some master-detail kind of things inside transactions. After doing some research on transactions (from general point-of-view), then I humbly make a conclusion that non data-aware components and hand-coded SQL would be the "perfect match" of transactions; But the data-aware components wouldn't be. They don't seem to be made for each other.
I have the real need to use transactions, but on the other hand I could not just throw the data-aware components away because they greatly simplify things.
Could somebody please enlighten me? I have been Googling it, but I have not found any useful answer. Perhaps because my English is not good enough that my keywords are limited.
BTW, I'm using Delphi 7 and currently evaluating UniDAC as the data access library.
Thank you.
EDIT
Example to describe an aspect of my question:
Imagine a form with 2 DBGrids on it. The first grid is MasterGrid and above it are these buttons: Add, Edit & Delete. The second grid is DetailGrid. If the user click Add, then it go like this:
- Connection.StartTransaction
- Master.Append then Master.Post then Master.Edit (so the master dataset has the autoincrement primary key, and it is editable now)
- Show the editing form modally, in which the user fills the master records, and also add some detail records using another form.
- If the user click OK, the app would do Master.Post and Connection.Commit. If the user click Cancel, then the app would do Connection.Rollback.
I know that transactions should be as short as possible, but you can see above that the transaction is only as short as the speed of the user filling the form.
If I were using non data-aware components, I would make custom insert SQLs based from user input, then execute the SQL between StartTransaction and Commit. So I can achieve very short transaction.
EDIT 2
I thank all of you for your kind participation. I pick the answer from vcldeveloper because it is the closest solution to my current need.