From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.140.148.197 with SMTP id 188mr29517928qhu.8.1437999709607; Mon, 27 Jul 2015 05:21:49 -0700 (PDT) X-Received: by 10.140.33.199 with SMTP id j65mr446909qgj.31.1437999709587; Mon, 27 Jul 2015 05:21:49 -0700 (PDT) Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!69no2207805qgl.1!news-out.google.com!4ni82350qgh.1!nntp.google.com!z61no3570947qge.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 27 Jul 2015 05:21:49 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=81.203.145.32; posting-account=AFCLjAoAAABJAOf_HjgEEEi3ty-lG5m2 NNTP-Posting-Host: 81.203.145.32 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Handling transactions? From: EGarrulo Injection-Date: Mon, 27 Jul 2015 12:21:49 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.giganews.com comp.lang.ada:194336 Date: 2015-07-27T05:21:49-07:00 List-Id: What is the Ada idiom to handle transactions in procedures? I mean, let's suppose we perform the following steps in a procedure: Obj_1.A (); Obj_2.B (); Obj_3.C (); Obj_4.D (); If we don't reach the last line because of an exception, we must undo the effects of any previous actions. My guess is that you would use a controlled type to embody a transaction, like this pseudo-code: Transaction.Start (); Obj_1.A (); Transaction.Add_Rollback (Rollback_Obj_1_A); Obj_2.B (); Transaction.Add_Rollback (Rollback_Obj_2_A); Obj_3.C (); Transaction.Add_Rollback (Rollback_Obj_3_A); Obj_4.D (); Transaction.Commit (); -- Don't run any registered rollback. Is this the way it is done, or is it any different? Thank you.