treedb_open_db()

treedb_open_db()#

treedb_open_db() initializes and opens a tree database within a tranger instance, using the specified schema and options.

Prototype

json_t *treedb_open_db(
    json_t      *tranger,
    const char  *treedb_name,
    json_t      *jn_schema,  // owned
    const char  *options     // "persistent"
);

Parameters

Key

Type

Description

tranger

json_t *

A reference to the tranger instance managing the database.

treedb_name

const char *

The name of the tree database to open.

jn_schema

json_t *

A JSON object defining the schema of the tree database. This parameter is owned by the function.

options

const char *

A string specifying options for opening the database, such as "persistent" to load the schema from a file.


Return Value

A JSON dictionary representing the opened tree database inside tranger. The returned object must not be used directly by the caller.

Notes

Ensure that tranger is already initialized before calling treedb_open_db(). The function follows a hierarchical structure where nodes are linked via parent-child relationships. If the persistent option is enabled, the schema is loaded from a file, and modifications require a version update.

Prototype

// Not applicable in JS

Prototype

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