Update multiple DW data
// Cainiao Code
Dw_1.up Dat E ()
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 a transaction is processed, multiple DW data is up.DatE, and then commit. By accident, we will find that the previous DW update is successful, but when the following table fails, it seems that the commit is executed and will not roll back.
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