comp.lang.ada
 help / color / mirror / Atom feed
* Handling transactions?
@ 2015-07-27 12:21 EGarrulo
  2015-07-27 14:16 ` Björn Lundin
  2015-07-29  6:51 ` Jacob Sparre Andersen
  0 siblings, 2 replies; 12+ messages in thread
From: EGarrulo @ 2015-07-27 12:21 UTC (permalink / raw)


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.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-29  6:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-27 12:21 Handling transactions? EGarrulo
2015-07-27 14:16 ` Björn Lundin
2015-07-27 14:38   ` EGarrulo
2015-07-27 14:53     ` Simon Wright
2015-07-27 16:38       ` David Botton
2015-07-27 18:15         ` EGarrulo
2015-07-28  0:10           ` Randy Brukardt
2015-07-28  5:33             ` J-P. Rosen
2015-07-28  6:45             ` Dmitry A. Kazakov
2015-07-28 20:23               ` Randy Brukardt
2015-07-28  2:41         ` Norman Worth
2015-07-29  6:51 ` Jacob Sparre Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox