%SSC_ROLLBACK

Roll back a transaction

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
value = %SSC_ROLLBACK(dbchannel[, SSQL_TXOFF|SSQL_TXON])

Return value

value

This function returns SSQL_NORMAL (success) or SSQL_FAILURE (failure). (i)

Arguments

dbchannel

An internal database channel previously initialized using %SSC_INIT and connected by %SSC_CONNECT. (n)

SSQL_TXOFF

(optional) Roll back the transaction for dbchannel. (n)

SSQL_TXON

(optional) Roll back current transaction for dbchannel (if there is one) and start a new explicit transaction. (n)

Discussion

%SSC_ROLLBACK either rolls back a transaction, starts a new transaction, or both, If it rolls back a transaction, it hard‑closes any associated cursors.

The default differs from one database to another. SSQL_TXOFF/SSQL_TXON is ignored for databases that don’t support different transaction states.

For databases such as SQL Server that support both explicit and implicit transactions, %SSC_ROLLBACK starts an explicit transaction. However, for Oracle and other databases that don’t support explicit transactions, %SSC_ROLLBACK does not start a transaction. In this case, the first data access (DML) operation (%SSC_OPEN, %SSC_EXECECUTE, %SSC_EXECIO) starts an implicit transaction. In addition, %SSC_ROLLBACK rolls back the transaction, and SSQL_TXON has the same effect as SSQL_TXOFF.

Note

Synergy databases do not support rollbacks. However, this call will still change the transaction mode.

For more information, see Understanding transactions and autocommit.

Examples

The following example shows how to roll back or commit a transaction, depending on the user’s selection.

if (abandon) then
  if (%ssc_rollback(dbchn, SSQL_TXOFF))
    goto err_exit
else
  if (%ssc_commit(dbchn, SSQL_TXOFF))
    goto err_exit