[Reprinted red fish] kbmmw development: kbmmw server transaction control

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.