treedb_get_instance()

treedb_get_instance()#

treedb_get_instance() retrieves a specific node instance from a TreeDB topic using both primary and secondary keys.

Prototype

json_t *treedb_get_instance(
    json_t       *tranger,
    const char   *treedb_name,
    const char   *topic_name,
    const char   *pkey2_name, // required
    const char   *id,         // primary key
    const char   *key2        // secondary key
);

Parameters

Key

Type

Description

tranger

json_t *

Pointer to the tranger database instance.

treedb_name

const char *

Name of the TreeDB database.

topic_name

const char *

Name of the topic within the TreeDB.

pkey2_name

const char *

Name of the secondary key field (required).

id

const char *

Primary key of the node instance.

key2

const char *

Secondary key of the node instance.


Return Value

Returns a pointer to a json_t object representing the requested node instance. The returned object is NOT owned by the caller and must not be modified or freed.

Notes

If the specified instance does not exist, NULL is returned. Use treedb_get_node() if only the primary key is needed.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples