Update multiple DW data

Source: Internet
Author: User

Update multiple DW data

// Cainiao code
Dw_1.update ()
Dw_2.update ()
Initial code
If dw_1.update () = 1 and dw_2.update () = 1 then
Commit;
Else
Rollback;
End if
Intermediate code
If dw_1.update () = 1 then
If dw_2.update () = 1 then
Commit;
Else
MessageBox ("prompt", "too much! ")
Rollback;
End if
Else
MessageBox ("prompt", "too much! ")
Rollback;
End if
Advanced Code
If dw_1.update () = 1 then
If dw_2.update () = 1 then
Commit;
Else
Rollback;
MessageBox ("prompt", "Drink less! ")
End if
Else
Rollback;
MessageBox ("prompt", "Drink less! ")
End if
Expert code
If dw_1.update (true, false) = 1 then
If dw_2.update (true, false) = 1 then
Dw_1.resetupdate ()
Dw_2.resetupdate ()
Commit;
Else
Rollback;
MessageBox ("prompt", "not high! ")
End if
Else
Rollback;
MessageBox ("prompt", "not high! ")
End if

 

 

When multiple DW data is updated, sometimes it cannot be all successfully updated. When transaction processing is performed, multiple DW data is updated and then commit. we may find that the previous DW update is successful, but when the subsequent table fails, it seems that the commit is executed and the rollback is not performed.

The correct syntax is as follows:
If dw_1.update (true, false) = 1 and dw_2.update (true, false) = 1... then
Commit;
Dw_1.resetupdate ();
Dw_2.resetupdate ();
...
Else
Rollback;
End if



Description: Functions of dw_restupdate ()

Clears the update flags in the primary and filter buffers and empties the delete buffer of A datawindow or datastore.

Usage:

When a row is changed, inserted, or deleted, its update flag is set, making it marked for update. by default the update method turns these flags off. however, if you want to coordinate updates of more than one datawindow or datastore, you can prevent update from clearing the flags. then after you verify that all the updates succeeded, you can call resetupdate for each datawindow to clear the flags. if one of the updates failed, you can keep the update flags, prompt the user to fix the problem, and try the updates again.

You can find out which rows are marked for update with the getitemstatus method. If a row is in the delete buffer or if it is in the primary or Filter Buffer and has newmodified! Or datamodified! Status, its update flag is set. After update flags are cleared, all rows have the status notmodified! Or New! And the delete buffer is empty.


This article is from the share blog, please be sure to keep this source http://harman.blog.51cto.com/1155829/1438971

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.