Difference between revisions of "COMPLETED()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Class==
 
Transaction Processing
 
 
 
 
==Purpose==
 
==Purpose==
 
Function to determine whether an error occurred during a multi-statement transaction
 
Function to determine whether an error occurred during a multi-statement transaction
Line 22: 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 failed."
+
      dialog box "Rollback failed."
endif
+
  endif
 
return
 
return
  
Line 33: Line 29:
 
on error do recovery
 
on error do recovery
 
begin transaction
 
begin transaction
reset in comm_2
+
    reset in comm_2
delete first 15
+
    delete first 15
insert
+
    insert
replace all t1 with (t2*t3)/100
+
    replace all t1 with (t2*t3)/100
list
+
    list
 
end transaction
 
end transaction
 
if completed()
 
if completed()
Line 48: Line 44:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 +
[[Category:Transaction Processing]]
 +
[[Category:Transaction Processing Functions]]

Latest revision as of 16:25, 27 November 2009

Purpose

Function to determine whether an error occurred during a multi-statement transaction


Syntax

COMPLETED()


See Also

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


Description

The COMPLETED() function returns .T. if no errors occurred during processing of any command issued between the BEGIN TRANSACTION and END TRANSACTION commands.


Example

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


Products

Recital Server, Recital