mco_edge_disconnect

Closes a connection to an edge database instance.

For an overview, see the Edge Client page.

Prototype

    MCO_RET mco_edge_disconnect(mco_edge_h eh);
    

Arguments

eh
Connection handle obtained from a previous mco_edge_connect() call. This handle is thread-local and must not be used after the function returns successfully.

Description

Closes the specified connection to an edge database instance, analogous to mco_db_disconnect() in the core runtime.

This function releases all resources associated with the connection handle, including internal buffers and synchronization objects. After successful disconnection, the handle eh becomes invalid and must not be used in subsequent API calls.

It is safe to call mco_edge_disconnect() even if the connection was never successfully established; in such cases, the function performs no operation and returns MCO_S_OK.

Applications should ensure that all transactions on the connection have been committed or rolled back before calling this function to avoid data inconsistency.

Return Codes

MCO_S_OK
Connection closed successfully.
MCO_E_ILLEGAL_PARAM
The specified connection handle eh is invalid or NULL.
MCO_E_NOINSTANCE
The connection does not exist or has already been closed.
MCO_E_TRANS_NOT_CLOSED
There are pending transactions on the connection that must be committed or rolled back before disconnecting.

Files

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