Difference between revisions of "ROLLBACK()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=ROLLBACK()=
 
 
 
==Class==
 
Transaction Processing
 
 
 
 
==Purpose==
 
==Purpose==
 
Function to verify success of a transaction rollback
 
Function to verify success of a transaction rollback
Line 15: Line 8:
  
 
==See Also==
 
==See Also==
[[SET ROLLBACK]], [[BEGIN TRANSACTION]], [[ISMARKED()]], [[RESET IN]], [[ROLLBACK]], [[END TRANSACTION ]], [[COMPLETED()]]
+
[[BEGIN TRANSACTION]], [[COMPLETED()]], [[ISMARKED()]], [[RESET IN]], [[ROLLBACK]], [[END TRANSACTION]], [[SET ROLLBACK]]
  
  
 
==Description==
 
==Description==
The ROLLBACK() function returns .T. if a rollback is successful and .F. if a rollback fails.  This function is used in conjunction with the ROLLBACK command to determine if an attempted rollback and recovery was successful.  Automatic rollback and recovery can be initiated within a BEGIN TRANSACTION END TRANSACTION block with the SET ROLLBACK ON command.
+
The ROLLBACK() function returns .T. if a rollback is successful and .F. if a rollback fails.  This function is used in conjunction with the ROLLBACK command to determine if an attempted rollback and recovery was successful.  Automatic rollback and recovery can be initiated within a BEGIN TRANSACTION...END TRANSACTION block with the SET ROLLBACK ON command.
  
  
Line 25: Line 18:
 
<code lang="recital">
 
<code lang="recital">
 
procedure recovery
 
procedure recovery
rollback
+
  rollback
if rollback()
+
  if rollback()
dialog box "Rollback was ok"
+
      dialog box "Rollback was ok"
else
+
  else
dialog box "Rollback not completed"
+
      dialog box "Rollback not completed"
endif
+
  endif
 
return
 
return
  
Line 36: Line 29:
 
on error do recovery
 
on error do recovery
 
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()
dialog box "Transaction completed"
+
    dialog box "Transaction completed"
else
+
    else
dialog box "Errors occurred during transaction"
+
    dialog box "Errors occurred during transaction"
 
endif  
 
endif  
 
</code>
 
</code>
Line 49: Line 42:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 +
[[Category:Transaction Processing]]
 +
[[Category:Transaction Processing Functions]]

Latest revision as of 15:18, 7 December 2009

Purpose

Function to verify success of a transaction rollback


Syntax

ROLLBACK()


See Also

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


Description

The ROLLBACK() function returns .T. if a rollback is successful and .F. if a rollback fails. This function is used in conjunction with the ROLLBACK command to determine if an attempted rollback and recovery was successful. Automatic rollback and recovery can be initiated within a BEGIN TRANSACTION...END TRANSACTION block with the SET ROLLBACK ON command.


Example

procedure recovery
  rollback
  if rollback()
      dialog box "Rollback was ok"
  else
      dialog box "Rollback not completed"
  endif
return
 
use masterfile
on error do recovery
begin transaction
    delete first 15
    replace all t1 with (t2*t3)/100
    list
end transaction
if completed()
    dialog box "Transaction completed"
    else
    dialog box "Errors occurred during transaction"
endif


Products

Recital, Recital Server