![]() |
![]() |
![]() |
GNOME Data Access 3.0 manual | ![]() |
---|---|---|---|---|
GdaServerOperation; enum GdaServerOperationType; enum GdaServerOperationNodeType; enum GdaServerOperationNodeStatus; GdaServerOperationNode; GdaServerOperation* gda_server_operation_new (GdaServerOperationType op_type, const gchar *xml_file); GdaServerOperationType gda_server_operation_get_op_type (GdaServerOperation *op); const gchar* gda_server_operation_op_type_to_string (GdaServerOperationType type); GdaServerOperationNode* gda_server_operation_get_node_info (GdaServerOperation *op, const gchar *path_format, ...); const GValue* gda_server_operation_get_value_at (GdaServerOperation *op, const gchar *path_format, ...); gboolean gda_server_operation_set_value_at (GdaServerOperation *op, const gchar *value, GError **error, const gchar *path_format, ...); xmlNodePtr gda_server_operation_save_data_to_xml (GdaServerOperation *op, GError **error); gboolean gda_server_operation_load_data_from_xml (GdaServerOperation *op, xmlNodePtr node, GError **error); 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); const gchar* gda_server_operation_get_sequence_name (GdaServerOperation *op, const gchar *path); guint gda_server_operation_get_sequence_size (GdaServerOperation *op, const gchar *path); guint gda_server_operation_get_sequence_max_size (GdaServerOperation *op, const gchar *path); guint gda_server_operation_get_sequence_min_size (GdaServerOperation *op, const gchar *path); gchar** gda_server_operation_get_sequence_item_names (GdaServerOperation *op, const gchar *path); guint gda_server_operation_add_item_to_sequence (GdaServerOperation *op, const gchar *path); gboolean gda_server_operation_del_item_from_sequence (GdaServerOperation *op, const gchar *item_path); gboolean gda_server_operation_is_valid (GdaServerOperation *op, const gchar *xml_file, GError **error);
"connection" GdaConnection* : Write / Construct Only "dict" GdaDict* : Write / Construct Only "op-type" gint : Read / Write / Construct Only "provider-obj" GdaServerProvider* : Write / Construct Only "spec-file" gchar* : Write / Construct Only
Basically this object is just a named data store: it can store named values, the values being
organized hirarchically. A value can be read from its path (similar to a Unix file path) using the
gda_server_operation_get_value_at()
method.
See the global introduction about DDL about how to use this object.
typedef enum { GDA_SERVER_OPERATION_CREATE_DB, GDA_SERVER_OPERATION_DROP_DB, GDA_SERVER_OPERATION_CREATE_TABLE, GDA_SERVER_OPERATION_DROP_TABLE, GDA_SERVER_OPERATION_RENAME_TABLE, GDA_SERVER_OPERATION_ADD_COLUMN, GDA_SERVER_OPERATION_DROP_COLUMN, GDA_SERVER_OPERATION_CREATE_INDEX, GDA_SERVER_OPERATION_DROP_INDEX, GDA_SERVER_OPERATION_NB } GdaServerOperationType;
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;
typedef enum { GDA_SERVER_OPERATION_STATUS_OPTIONAL, GDA_SERVER_OPERATION_STATUS_REQUIRED, GDA_SERVER_OPERATION_STATUS_UNKNOWN } GdaServerOperationNodeStatus;
typedef struct { GdaServerOperationNodeType type; GdaServerOperationNodeStatus status; GdaParameterList *plist; GdaDataModel *model; GdaColumn *column; GdaParameter *param; gpointer priv; } GdaServerOperationNode;
GdaServerOperation* gda_server_operation_new (GdaServerOperationType op_type, const gchar *xml_file);
Creates a new GdaServerOperation object from the xml_file
specifications
The xml_file
must respect the DTD described in the "libgda-server-operation.dtd" file: its top
node must be a <serv_op> tag.
|
|
|
a file which has the specifications for the GdaServerOperation object to create |
Returns : |
a new GdaServerOperation object |
GdaServerOperationType gda_server_operation_get_op_type (GdaServerOperation *op);
Get the type of operation op
is for
|
a GdaServerOperation object |
Returns : |
const gchar* gda_server_operation_op_type_to_string (GdaServerOperationType type);
Get a string version of type
|
|
Returns : |
a non NULL string (do not free or modify)
|
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
|
a GdaServerOperation object |
|
a complete path to a node (starting with "/") |
|
|
Returns : |
a GdaServerOperationNode structure, or NULL if the node was not found
|
const GValue* gda_server_operation_get_value_at (GdaServerOperation *op, const gchar *path_format, ...);
Get the value for the node at the path formed using path_format
and ... (the rules are the same as
for g_strdup_printf()
)
|
a GdaServerOperation object |
|
a complete path to a node (starting with "/") |
|
arguments to use with path_format to make a complete path
|
Returns : |
a constant GValue if a value has been defined, or NULL if the value is undefined or
if the path is not defined or path does not hold any value.
|
gboolean gda_server_operation_set_value_at (GdaServerOperation *op, const gchar *value, GError **error, const gchar *path_format, ...);
Set the value for the node at the path formed using path_format
and ... the rules are the same as
for g_strdup_printf()
)
Here are the corner cases:
If the path corresponds to a GdaParameter, then the parameter is set to value
If the path corresponds to a sequence item like for example "/SEQUENCE_NAME/5/NAME" for the "NAME" value of the 6th item of the "SEQUENCE_NAME" sequence then:
if the sequence already has 6 or more items, then the value is just set to the corresponding value in the 6th item of the sequence
if the sequence has less then 6 items, then items are added up to the 6th one before setting the value to the corresponding in the 6th item of the sequence
If the path corresponds to a GdaDataModel, like for example "/ARRAY/COLUMN
/5" for the value at the
6th row of the "COLUMN" column of the "ARRAY" data model, then:
if the data model already contains 6 or more rows, then the value is just set
if the data model has less than 6 rows, then rows are added up to the 6th one before setting the value
|
a GdaServerOperation object |
|
a string |
|
a place to store errors or NULL
|
|
a complete path to a node (starting with "/") |
|
arguments to use with path_format to make a complete path
|
Returns : |
TRUE if no error occurred |
xmlNodePtr gda_server_operation_save_data_to_xml (GdaServerOperation *op, GError **error);
Creates a new xmlNodePtr tree which can be used to save the op object. This XML structure can then be saved to disk if necessary. Use xmlFreeNode to free the associated memory when not needed anymore.
|
a GdaServerOperation object |
|
a place to store errors or NULL
|
Returns : |
a new xmlNodePtr structure, or NULL
|
gboolean gda_server_operation_load_data_from_xml (GdaServerOperation *op, xmlNodePtr node, GError **error);
Loads the contents of node
into op
. The XML tree passed through the node
argument must correspond to an XML tree saved using gda_server_operation_save_data_to_xml()
.
|
a GdaServerOperation object |
|
a xmlNodePtr |
|
a place to store errors or NULL
|
Returns : |
TRUE if no error occurred
|
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
.
|
a GdaServerOperation object |
Returns : |
a new array, which must be freed with g_strfreev() .
|
GdaServerOperationNodeType gda_server_operation_get_node_type (GdaServerOperation *op, const gchar *path, GdaServerOperationNodeStatus *status);
Convenience function to get the type of a node.
|
a GdaServerOperation object |
|
a complete path to a node (starting with "/") |
|
a place to store the status of the node, or NULL
|
Returns : |
the type of node, or GDA_SERVER_OPERATION_NODE_UNKNOWN if the node was not found |
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
|
a GdaServerOperation object |
|
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.
|
gchar* gda_server_operation_get_node_path_portion (GdaServerOperation *op, const gchar *path);
Get the last part of path
|
a GdaServerOperation object |
|
a complete path to a node (starting with "/") |
Returns : |
a new string, or NULL if an error occurred
|
const gchar* gda_server_operation_get_sequence_name (GdaServerOperation *op, const gchar *path);
|
a GdaServerOperation object |
|
a complete path to a sequence node (starting with "/") |
Returns : |
the name of the sequence at path
|
guint gda_server_operation_get_sequence_size (GdaServerOperation *op, const gchar *path);
|
a GdaServerOperation object |
|
a complete path to a sequence node (starting with "/") |
Returns : |
the number of items in the sequence at path , or 0 if path is not a sequence node
|
guint gda_server_operation_get_sequence_max_size (GdaServerOperation *op, const gchar *path);
|
a GdaServerOperation object |
|
a complete path to a sequence node (starting with "/") |
Returns : |
the maximum number of items in the sequence at path , or 0 if path is not a sequence node
|
guint gda_server_operation_get_sequence_min_size (GdaServerOperation *op, const gchar *path);
|
a GdaServerOperation object |
|
a complete path to a sequence node (starting with "/") |
Returns : |
the minimum number of items in the sequence at path , or 0 if path is not a sequence node
|
gchar** gda_server_operation_get_sequence_item_names (GdaServerOperation *op, const gchar *path);
Fetch the contents of a sequence. path
can describe either a sequence (for example "/SEQNAME") or an item in a sequence
(for example "/SEQNAME/3")
|
a GdaServerOperation object |
|
a complete path to a sequence node (starting with "/") |
Returns : |
a array of strings containing the complete paths of the nodes contained at path (free with g_strfreev() )
|
guint gda_server_operation_add_item_to_sequence (GdaServerOperation *op, const gchar *path);
|
|
|
|
Returns : |
gboolean gda_server_operation_del_item_from_sequence (GdaServerOperation *op, const gchar *item_path);
|
|
|
|
Returns : |
gboolean gda_server_operation_is_valid (GdaServerOperation *op, const gchar *xml_file, GError **error);
Tells if all the required values in op
have been defined.
if xml_file
is not NULL
, the validity of op
is tested against that specification,
and not againts the current op
's specification.
|
a GdaServerOperation widget |
|
an XML specification file (see gda_server_operation_new() )
|
|
a place to store an error, or NULL
|
Returns : |
TRUE if op is valid
|
"op-type"
property"op-type" gint : Read / Write / Construct Only
Allowed values: [0,8]
Default value: 0
"sequence-item-added"
signalvoid user_function (GdaServerOperation *gdaserveroperation, gchar *arg1, gint arg2, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
|
|
user data set when the signal handler was connected. |
"sequence-item-remove"
signalvoid user_function (GdaServerOperation *gdaserveroperation, gchar *arg1, gint arg2, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
|
|
user data set when the signal handler was connected. |