From: EGarrulo <egarrulo@gmail.com>
Subject: Handling transactions?
Date: Mon, 27 Jul 2015 05:21:49 -0700 (PDT)
Date: 2015-07-27T05:21:49-07:00 [thread overview]
Message-ID: <d075fc4c-083d-4654-b04a-15f84c8511c9@googlegroups.com> (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.
next reply other threads:[~2015-07-27 12:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 12:21 EGarrulo [this message]
2015-07-27 14:16 ` Handling transactions? 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox