Subject Need a little guidance with transactions
Author jlane_campbell
I inherited an application in which my predecessor defined an IBOTransaction and applied it to over a hundred datasets. (I'm shepherding about 200k lines of code, so I've not gotten around to changing it because it was working ... sort of). Still, I'm questioning whether the app is using transactions in the right way.

The app (Delphi) has several data modules, and about 1,000 queries. It also has a couple of forms that are being used in an MDI-type environment, meaning that several instances of each can be up and showing. Because of this, each form has TIBOQueries attached to it, so that each form gets its own instantiation of its queries -- thus preventing the forms from "stepping on each other".

Each form's queries have a "parent/multi-children" relationship, so when the user saves/applies, a transaction & rollback on error is indicated; therefore in this case, the transaction object actually gets used. But I'm wondering -- sharing the single transaction among multiple forms -- is probably wrong. Should I instead place a transaction object on the form, such that there's a separate instantiation of it, along with the queries that depend on it? Would this be a cleaner overall approach?

Looking for advice, and perhaps a better handle on the practical use of transactions...


Lane Campbell
NW Software