mco_edge_trans_rollback

Rolls back the changes made within an edge database transaction.

For an overview, see the Edge Client page.

Prototype

    MCO_RET mco_edge_trans_rollback(mco_trans_h t);
    

Arguments

t
Transaction handle obtained from a previous mco_edge_trans_start() call.

Description

Discards all modifications made during the specified transaction and releases associated resources, analogous to mco_trans_rollback() in the core runtime.

This function is typically called when an error occurs during transaction execution or when the application explicitly decides to cancel pending changes. Upon successful rollback, the transaction handle t becomes invalid and must not be used in subsequent API calls.

Unlike mco_edge_trans_commit(), a rollback does not mark data for synchronization with the server. All uncommitted changes are permanently discarded from the edge database's ring buffer, freeing space for new transactions.

It is safe to call mco_edge_trans_rollback() even if the transaction is already in an error state; the function will clear any stored error codes and ensure a clean transaction termination.

Return Codes

MCO_S_OK
Transaction rolled back successfully.
MCO_E_ILLEGAL_PARAM
The transaction handle t is invalid or NULL.

Files

Header file:
mcoedge.h
Source file:
mcoiotedgedb.c
Library:
libmcoiotedge.a