The transaction control of kbmmw has been implemented on the client. kbmmwclienttransaction is used to control the submission of multiple datasets. Multiple datasets are submitted on the client,
In fact, it is to implement the business logic on the client side and process data through a transaction. This is a violation of the multi-layer architecture. In actual projects, you need,
We often use multiple datasets for business processing and transaction control. What should we do? In other words, how to implement transaction control in the service.
Kbmmw is on the server, just like on the client, providing us with a convenient mechanism to handle transactions.
The following code is transferred from the kbmmw newsgroup:
VaR TX: tkbmmwtransaction;
Begin
TX: = tkbmmwtransaction. Create;
Try
Try
TX. addconnection (srvcore. mwdbconpool. getbestconnection );
TX. starttransaction;
Qquerydel. Execute (TX); // If exec type statement
Qquerydel. Resolve (TX); // If resolve qanotherquery. Resolve (TX );
TX. committransaction; Result: = true;
Except
TX. rollbacktransaction;
Raise;
End;
Finally
TX. releaseconnections;
TX. Free;
End;
End;
From the code above, we can see that kbmmw provides tkbmmwtransaction to control the transaction control on the server. The usage is concise and clear at first glance.