11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Caché</strong> <strong>ObjectScript</strong> CommandsArgumentspcAn optional postconditional expression. <strong>Caché</strong> executes the command if the postconditionalexpression is true (evaluates to a non-zero numeric value). <strong>Caché</strong> does not execute the commandif the postconditional expression is false (evaluates to zero). For further details, referto Command Postconditional Expressions in Using <strong>Caché</strong> <strong>ObjectScript</strong>.ExamplesThe following example shows the effects of TROLLBACK on nested transactions. EachTSTART increments $TLEVEL and sets a global. Issuing a TCOMMIT on the inner nestedtransaction decrements $TLEVEL, but the commitment of changes made in a nested transactionis deferred. In this case, the subsequent TROLLBACK on the outer transaction rollsback all changes made, including those in the inner “committed” nested transaction.SET ^a(1)="[- - -]",^b(1)="[- - -]"WRITE !,"level:",$TLEVEL," ",^a(1)," ",^b(1)TSTARTLOCK +^a(1)SET ^a(1)="hello"WRITE !,"level:",$TLEVEL," ",^a(1)," ",^b(1)TSTARTLOCK +^b(1)SET ^b(1)="world"WRITE !,"level:",$TLEVEL," ",^a(1)," ",^b(1)TCOMMITWRITE !,"After TCOMMIT"WRITE !,"level:",$TLEVEL," ",^a(1)," ",^b(1)TROLLBACKWRITE !,"After TROLLBACK"WRITE !,"level:",$TLEVEL," ",^a(1)," ",^b(1)QUITThe following example shows how TROLLBACK rolls back global variables, but not localvariables:140 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!