Loading...
 

AbortTXN

AbortTXN

AbortTXN, AbortTXN(UNSAFE)

Stack
Stack Description
Stack(In) -
Stack(Out) -

cancels the current transaction. All changes related to the database (within the last transaction) will not take effect.
Appropriately, InstantView® variables and other status values of the ClassiX® system are automatically reset to the value at the beginning of the transaction; regardless of whether the transaction was started automatically by InstantView® or explicitly with BeginTXN . If no transaction was started (no BeginTXN and no persistent access), the state of ClassiX® is not reset.

AbortTXN(UNSAFE) 208630
AbortTXN optionally accepts the flag UNSAFE. This can explicitly prevent that the state of ClassiX is rolled back to the state before the beginning of the transaction. This means that module variables, static variables and global variables can point to deleted memory after an AbortTXN (if a CreatePersObject was rolled back via AbortTXN ). Similarly, after an AbortTXN there may still be windows open that hold deleted objects. When using AbortTXN(UNSAFE) it is the responsibility of the developer to ensure that no invalid variables are referenced and that the corresponding windows are closed.

This mechanism can currently be used in order not to reset variables that control the higher-level program logic in an AbortTXN . This mechanism is only temporary and will be replaced in the future by a corresponding language construct with which individual variables can be specifically protected from being reset.

Finally, the transaction termination starts the garbage collection.

Code example:

Var(pi) 3.1415926 -> pi BeginTXN 3 -> pi //change pi to 3 AbortTXN //pi gets reset to 3.1415926 pi 3 = ifnot { "OK" Attention(,INFO) }
Local variables are currently not reset by AbortTXN or cancel

Apart from the instruction AbortTXN, a transaction is aborted by the ClassiX® system in the following cases:

  • InstantView® cancel instruction is executed
  • an error detected by ClassiX® or ObjectStore® is reported
Related topics