treedb_autolink()
#
treedb_autolink()
automatically links a node using foreign key fields from the provided JSON object.
Prototype
int treedb_autolink(
json_t *tranger,
json_t *node, // NOT owned, pure node
json_t *kw, // owned
BOOL save
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Pointer to the tranger database instance. |
|
|
Pointer to the node to be linked. This node is not owned by the function. |
|
|
JSON object containing foreign key fields used for auto-linking. This object is owned by the function. |
|
|
Flag indicating whether to save the changes to the database. |
Return Value
Returns 0
on success, or a negative error code on failure.
Notes
The function uses the foreign key fields in kw
to establish links between nodes.
If save
is TRUE
, the changes are persisted in the database.
The node
parameter must be a valid pure node object.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples