![]() |
![]() |
![]() |
GNOME Data Access 3.0 manual | ![]() |
---|---|---|---|---|
GdaParameterListGdaParameterList — Manages a list of GdaParameter objects which contain individual values |
GdaParameterList; enum GdaParameterListParamHint; GdaParameterListNode; GdaParameterListGroup; GdaParameterListSource; GdaParameterList* gda_parameter_list_new (GSList *params); GdaParameterList* gda_parameter_list_new_inline (GdaDict *dict, ...); GdaParameterList* gda_parameter_list_new_from_spec_string (GdaDict *dict, const gchar *xml_spec, GError **error); guint gda_parameter_list_get_length (GdaParameterList *paramlist); gchar* gda_parameter_list_get_spec (GdaParameterList *paramlist); void gda_parameter_list_add_param (GdaParameterList *paramlist, GdaParameter *param); GdaParameter* gda_parameter_list_add_param_from_string (GdaParameterList *paramlist, const gchar *name, GType type, const gchar *str); GdaParameter* gda_parameter_list_add_param_from_value (GdaParameterList *paramlist, const gchar *name, GValue *value); gboolean gda_parameter_list_is_coherent (GdaParameterList *paramlist, GError **error); gboolean gda_parameter_list_is_valid (GdaParameterList *paramlist); GdaParameter* gda_parameter_list_find_param (GdaParameterList *paramlist, const gchar *param_name); GdaParameterListNode* gda_parameter_list_find_node_for_param (GdaParameterList *paramlist, GdaParameter *param); GdaParameterListSource* gda_parameter_list_find_source_for_param (GdaParameterList *paramlist, GdaParameter *param); GdaParameterListSource* gda_parameter_list_find_source (GdaParameterList *paramlist, GdaDataModel *model); void gda_parameter_list_set_param_default_value (GdaParameterList *paramlist, GdaParameter *param, const GValue *value); void gda_parameter_list_set_param_default_alias (GdaParameterList *paramlist, GdaParameter *param, GdaParameter *alias); const GValue* gda_parameter_list_get_param_default_value (GdaParameterList *paramlist, GdaParameter *param);
"param-attr-changed" : Run First "param-changed" : Run First "param-plugin-changed" : Run First "public-data-changed" : Run First
A GdaParameterList is in a way only a better than GList list of GdaParameter objects: it handles a list of GdaParameter objects (accessible directly using paramlist->parameters) but also creates other lists such as:
a list of GdaParameterListNode structures (the nodes_list attribute): for each parameter a such structure is created to show in a signle place all the information about each parameter: the GdaDataModel which may restrict the list of values along with the column number in it, and any hint for the parameter (a value made of GdaParameterListParamHint flags)
a list of GdaParameterListSource structures (the sources_list attribute): each GdaParameterListSource structure is complementary to the GdaParameterListNode structures listed in its "nodes" attribute: there is one such structure for each GdaDataModel which may restrict values of one or more parameters.
a list of GdaParameterListGroup structures (the groups_list attribute): there is one such structure for each _independant_ parameter (parameters which are constrained by the same data model all appear in the same GdaParameterListGroup structure)
Some queries require arguments before they can be executed. For such queries, the arguments are passed using
GdaParameter objects (the list of parameters can be obtained using gda_query_get_parameters()
or
gda_query_get_parameter_list()
).
typedef enum { GDA_PARAMETER_LIST_PARAM_READ_ONLY = 1 << 0, /* param should not be affected by user modifications */ GDA_PARAMETER_LIST_PARAM_HIDE = 1 << 1 /* param should not be shown to the user */ } GdaParameterListParamHint;
typedef struct { GdaParameter *param; /* Can't be NULL */ GdaDataModel *source_model; /* may be NULL if @param is free-fill */ gint source_column; /* unused is @source_model is NULL */ guint hint; } GdaParameterListNode;
For each GdaParameter object in the GdaParameterList object, there is a GdaParameterListNode structure which sums up all the information for each parameter.
typedef struct { GSList *nodes; /* list of GdaParameterListNode, at least one entry */ GdaParameterListSource *nodes_source; /* if NULL, then @nodes contains exactly one entry */ } GdaParameterListGroup;
The GdaParameterListGroup is another view of the parameters list contained in the GdaParameterList object: there is one such structure for each _independant_ parameter (parameters which are constrained by the same data model all appear in the same GdaParameterListGroup structure).
typedef struct { GdaDataModel *data_model; /* Can't be NULL */ GSList *nodes; /* list of #GdaParameterListNode for which source_model == @data_model */ /* displayed columns in 'data_model' */ gint shown_n_cols; gint *shown_cols_index; /* columns used as a reference (corresponding to PK values) in 'data_model' */ gint ref_n_cols; gint *ref_cols_index; }; #define GDA_PARAMETER_LIST_NODE(x) ((GdaParameterListNode *)x) #define GDA_PARAMETER_LIST_SOURCE(x) ((GdaParameterListSource *)x) #define GDA_PARAMETER_LIST_GROUP(x) ((GdaParameterListGroup *)x) /* struct for the object's data */ struct _GdaParameterList { GdaObject object; GSList *parameters; /* list of GdaParameter objects */ GSList *nodes_list; /* list of GdaParameterListNode */ GSList *sources_list; /* list of GdaParameterListSource */ GSList *groups_list; /* list of GdaParameterListGroup */ GdaParameterListPrivate *priv; } GdaParameterListSource;
There is a GdaParameterListSource structure for each GdaDataModel which constrains at least on parameter in the GdaParameterList object.
GdaParameterList* gda_parameter_list_new (GSList *params);
Creates a new GdaParameterList object, and populates it with the list given as argument.
The list can then be freed as it gets copied. All the parameters in params
are referenced counted
and modified, so they should not be used anymore afterwards, and the params
list gets copied
(so it should be freed by the caller).
|
a list of GdaParameter objects |
Returns : |
a new GdaParameterList object |
GdaParameterList* gda_parameter_list_new_inline (GdaDict *dict, ...);
Creates a new GdaParameterList containing parameters defined by each triplet in ... For each triplet (name, Glib type and value), the value must be of the correct type (gchar * if type is G_STRING, ...)
|
a GdaDict object, or NULL
|
|
a serie of a (const gchar*) name, (GType) type, and value, terminated by a NULL
|
Returns : |
a new GdaParameterList object |
GdaParameterList* gda_parameter_list_new_from_spec_string (GdaDict *dict, const gchar *xml_spec, GError **error);
Creates a new GdaParameterList object from the xml_spec
specifications
|
a GdaDict object, or NULL
|
|
a string |
|
a place to store the error, or NULL
|
Returns : |
a new object, or NULL if an error occurred
|
guint gda_parameter_list_get_length (GdaParameterList *paramlist);
Get the number of GdaParameter objects in paramlist
|
a GdaParameterList object |
Returns : |
gchar* gda_parameter_list_get_spec (GdaParameterList *paramlist);
Get the specification as an XML string. See the gda_parameter_list_new_from_spec_string()
form more information about the XML specification string format.
|
a GdaParameterList object |
Returns : |
a new string |
void gda_parameter_list_add_param (GdaParameterList *paramlist, GdaParameter *param);
Adds param
to the list of parameters managed within paramlist
.
WARNING: the paramlist may decide not to use the param
parameter, but to
modify another parameter already present within the paramlist. The publicly available
lists from the paramlist
object may also be changed in the process.
|
a GdaParameterList object |
|
a GdaParameter object |
GdaParameter* gda_parameter_list_add_param_from_string (GdaParameterList *paramlist, const gchar *name, GType type, const gchar *str);
Creates and adds a new GdaParameter to paramlist
. The ID and name of the new parameter
are set as name
. The parameter's value is set from str
.
|
a GdaParameterList object |
|
the name to give to the new parameter |
|
the type of parameter to add |
|
the string representation of the parameter |
Returns : |
the new GdaParameter for information, or NULL if an error occurred
|
GdaParameter* gda_parameter_list_add_param_from_value (GdaParameterList *paramlist, const gchar *name, GValue *value);
Creates and adds a new GdaParameter to paramlist
. The ID and name of the new parameter
are set as name
. The parameter's value is a copy of value
.
|
a GdaParameterList object |
|
the name to give to the new parameter |
|
the value to give to the new parameter, must not be NULL or of type null |
Returns : |
the new GdaParameter for information, or NULL if an error occurred
|
gboolean gda_parameter_list_is_coherent (GdaParameterList *paramlist, GError **error);
Checks that paramlist
has a coherent public data structure
|
a GdaParameterList object |
|
|
Returns : |
TRUE if paramlist is coherent
|
gboolean gda_parameter_list_is_valid (GdaParameterList *paramlist);
Tells if all the paramlist's parameters have valid data
|
a GdaParameterList object |
Returns : |
TRUE if the paramlist is valid |
GdaParameter* gda_parameter_list_find_param (GdaParameterList *paramlist, const gchar *param_name);
Finds a GdaParameter using its name
|
a GdaParameterList object |
|
the name of the requested parameter |
Returns : |
a GdaParameter or NULL
|
GdaParameterListNode* gda_parameter_list_find_node_for_param (GdaParameterList *paramlist, GdaParameter *param);
Finds a GdaParameterListNode holding information for param
, don't modify the returned structure
|
a GdaParameterList object |
|
a GdaParameter object |
Returns : |
a GdaParameterListNode or NULL
|
GdaParameterListSource* gda_parameter_list_find_source_for_param (GdaParameterList *paramlist, GdaParameter *param);
Finds a GdaParameterListSource which contains the GdaDataModel restricting the possible values of
param
, don't modify the returned structure.
|
a GdaParameterList object |
|
a GdaParameter object |
Returns : |
a GdaParameterListSource or NULL
|
GdaParameterListSource* gda_parameter_list_find_source (GdaParameterList *paramlist, GdaDataModel *model);
Finds the GdaParameterListSource structure used in paramlist
for which model
is a
the data model, don't modify the returned structure
|
a GdaParameterList object |
|
a GdaDataModel object |
Returns : |
a GdaParameterListSource pointer or NULL .
|
void gda_parameter_list_set_param_default_value (GdaParameterList *paramlist, GdaParameter *param, const GValue *value);
Stores value
in paramlist
to make it possible for paramlist
's users to find a default value
for param
when one is required, instead of NULL
.
paramlist
only provides a storage functionnality, the way the value obtained with
gda_parameter_list_get_param_default_value()
is used is up to paramlist
's user.
|
a GdaParameterList object |
|
a GdaParameter object, managed by paramlist
|
|
a GValue, of the same type as param , or NULL
|
void gda_parameter_list_set_param_default_alias (GdaParameterList *paramlist, GdaParameter *param, GdaParameter *alias);
|
|
|
|
|
const GValue* gda_parameter_list_get_param_default_value (GdaParameterList *paramlist, GdaParameter *param);
Retreives a prefered default value to be used by paramlist
's users when necessary.
The usage of such values is decided by paramlist
's users.
paramlist
only offers to store the value
using gda_parameter_list_set_param_default_value()
or to store a GdaParameter reference from which to get
a value using gda_parameter_list_set_param_default_alias()
.
|
a GdaParameterList object |
|
a GdaParameter object, managed by paramlist
|
Returns : |
a GValue, or NULL .
|
"param-attr-changed"
signalvoid user_function (GdaParameterList *gdaparameterlist, GdaParameter *arg1, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"param-changed"
signalvoid user_function (GdaParameterList *gdaparameterlist, GdaParameter *arg1, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"param-plugin-changed"
signalvoid user_function (GdaParameterList *gdaparameterlist, GdaParameter *arg1, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"public-data-changed"
signalvoid user_function (GdaParameterList *gdaparameterlist, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |