Difference between revisions of "SET ROLLBACK"

From Recital Documentation Wiki
Jump to: navigation, search
(Example)
Line 25: Line 25:
  
 
==Example==
 
==Example==
<pre>
+
<ode lang="recital">
 
use setcomm
 
use setcomm
 
set rollback on
 
set rollback on
 
begin transaction
 
begin transaction
delete first 15
+
    delete first 15
replace all t1 with (t2*t3)/100
+
    replace all t1 with (t2*t3)/100
list
+
    list
 
end transaction
 
end transaction
if completed()
+
if completed()   && determine if the transaction was successful
dialog box "Transaction completed"
+
    dialog box "Transaction completed"
 
else
 
else
dialog box "Errors occurred during transaction"
+
    dialog box "Errors occurred during transaction"
endif</pre>
+
endif</code>
 
+
  
 
==Products==
 
==Products==

Revision as of 06:29, 12 March 2009

SET ROLLBACK

Class

Multi-User


Purpose

Enable or disable automatic rollback


Syntax

SET ROLLBACK ON | OFF | (<expL>)


See Also

BEGIN TRANSACTION, END TRANSACTION, RESET IN, ROLLBACK, COMPLETED(), ISMARKED(), ROLLBACK()


Description

The SET ROLLBACK ON command invokes automatic rollback and recovery in all tables affected by transactions performed within a BEGIN TRANSACTION....END TRANSACTION block. A ’rollback’ causes record contents to be restored to their value before modification (e.g. at the time BEGIN TRANSACTION was issued). This is particularly useful if an error occurs during the execution of a program or if an Applications Data Dictionary validation constraint is not satisfied.

When BEGIN TRANSACTION is issued all currently open files and all files opened between BEGIN and END TRANSACTION will have Before Image Journaling invoked automatically. To disable rollback for a particular workarea, see the RESET IN command. Recital Corporation recommends the use of the SET ROLLBACK ON command to obtain automatic rollback and recovery on multi-statement transactions. By default, ROLLBACK is OFF.


Example

<ode lang="recital"> use setcomm set rollback on begin transaction

   delete first 15
   replace all t1 with (t2*t3)/100
   list

end transaction if completed() && determine if the transaction was successful

   dialog box "Transaction completed"

else

   dialog box "Errors occurred during transaction"

endif</code>

Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer