## GdaServerOperation: individual nodes

GdaServerOperation: individual nodes — Getting information about parts (nodes) composing a path

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    enum                GdaServerOperationNodeType;
    enum                GdaServerOperationNodeStatus;
                        GdaServerOperationNode;
    GdaServerOperationNode * gda_server_operation_get_node_info
                                                            (GdaServerOperation *op,
                                                             const gchar *path_format,
                                                             ...);
    gchar **            gda_server_operation_get_root_nodes (GdaServerOperation *op);
    GdaServerOperationNodeType gda_server_operation_get_node_type
                                                            (GdaServerOperation *op,
                                                             const gchar *path,
                                                             GdaServerOperationNodeStatus *status);
    gchar *             gda_server_operation_get_node_parent
                                                            (GdaServerOperation *op,
                                                             const gchar *path);
    gchar *             gda_server_operation_get_node_path_portion
                                                            (GdaServerOperation *op,
                                                             const gchar *path);

## Description

To each part of a path is associated a node (as a GdaServerOperationNode structure). For example the "/TABLE_DEF_P/TABLE_NAME" path has two nodes, one associated to "/TABLE_DEF_P" and one to "/TABLE_DEF_P/TABLE_NAME". For more information about the path's format, see the `gda_server_operation_set_value_at()`'s documentation.

This API is designed to get information about all the nodes present in a GdaServerOperation object (refer to the `gda_server_operation_get_root_nodes()` function) and about each node of a path, and allows inspection of its contents. It is mainly reserved for database provider's implementations but can have its purpose outside of this scope.

## Details

### enum GdaServerOperationNodeType

    typedef enum {
    	GDA_SERVER_OPERATION_NODE_PARAMLIST,
    	GDA_SERVER_OPERATION_NODE_DATA_MODEL,
    	GDA_SERVER_OPERATION_NODE_PARAM,
    	GDA_SERVER_OPERATION_NODE_SEQUENCE,
    	GDA_SERVER_OPERATION_NODE_SEQUENCE_ITEM,

    	GDA_SERVER_OPERATION_NODE_DATA_MODEL_COLUMN,
    	GDA_SERVER_OPERATION_NODE_UNKNOWN
    } GdaServerOperationNodeType;

### enum GdaServerOperationNodeStatus

    typedef enum {
    	GDA_SERVER_OPERATION_STATUS_OPTIONAL,
    	GDA_SERVER_OPERATION_STATUS_REQUIRED,
    	GDA_SERVER_OPERATION_STATUS_UNKNOWN
    } GdaServerOperationNodeStatus;

### GdaServerOperationNode

    typedef struct {
    	GdaServerOperationNodeType    type;
    	GdaServerOperationNodeStatus  status;

    	GdaSet                       *plist;
    	GdaDataModel                 *model;
    	GdaColumn                    *column;
    	GdaHolder                    *param;
    	gpointer                      priv;
    } GdaServerOperationNode;

### gda_server_operation_get_node_info ()

    GdaServerOperationNode * gda_server_operation_get_node_info
                                                            (GdaServerOperation *op,
                                                             const gchar *path_format,
                                                             ...);

Get information about the node identified by `path`. The returned GdaServerOperationNode structure can be copied but not modified; it may change or cease to exist if `op` changes

`op` : | a GdaServerOperation object
`path_format` : | a complete path to a node (starting with "/") as a format string, similar to `g_strdup_printf()`'s argument
`...` : | the arguments to insert into the format string
Returns : | a GdaServerOperationNode structure, or `NULL` if the node was not found. [transfer none][allow-none]

### gda_server_operation_get_root_nodes ()

    gchar **            gda_server_operation_get_root_nodes (GdaServerOperation *op);

Get an array of strings containing the paths of nodes situated at the root of `op`.

`op` : | a GdaServerOperation object
Returns : | a new array, which must be freed with `g_strfreev()`. [transfer full]

### gda_server_operation_get_node_type ()

    GdaServerOperationNodeType gda_server_operation_get_node_type
                                                            (GdaServerOperation *op,
                                                             const gchar *path,
                                                             GdaServerOperationNodeStatus *status);

Convenience function to get the type of a node.

`op` : | a GdaServerOperation object
`path` : | a complete path to a node (starting with "/")
`status` : | a place to store the status of the node, or `NULL`. [allow-none]
Returns : | the type of node, or GDA_SERVER_OPERATION_NODE_UNKNOWN if the node was not found

### gda_server_operation_get_node_parent ()

    gchar *             gda_server_operation_get_node_parent
                                                            (GdaServerOperation *op,
                                                             const gchar *path);

Get the complete path to the parent of the node defined by `path`

`op` : | a GdaServerOperation object
`path` : | a complete path to a node (starting with "/")
Returns : | a new string or `NULL` if the node does not have any parent or does not exist. [transfer full]

### gda_server_operation_get_node_path_portion ()

    gchar *             gda_server_operation_get_node_path_portion
                                                            (GdaServerOperation *op,
                                                             const gchar *path);

Get the last part of `path`

`op` : | a GdaServerOperation object
`path` : | a complete path to a node (starting with "/")
Returns : | a new string, or `NULL` if an error occurred. [transfer full]

## See Also

GdaServerOperation