1
<!-- ##### SECTION Title ##### -->
4
<!-- ##### SECTION Short_Description ##### -->
5
Manages all the #MgParameter objects required to execute a query
7
<!-- ##### SECTION Long_Description ##### -->
9
Some queries require arguments before they can be executed. For such queries, the arguments are passed using
10
#MgParameter objects (the list of parameters can be obtained using mg_entity_get_parameters()).
11
The #MgContext object removes the hassle
12
of managing these #MgParameter objects. For a query, a #MgContext can be obtained using the
13
mg_entity_get_exec_context() function.
16
Each #MgContext object then provides two lists to be used by the programmer: the 'parameters' list which is a simple
17
copy of the parameters list given as argument to mg_context_new(), and the 'nodes' list which is a list of
18
#MgContextNode structures created by the #MgContext object. These two lists should not be modified.
21
<!-- ##### SECTION See_Also ##### -->
26
<!-- ##### STRUCT MgContext ##### -->
32
<!-- ##### SIGNAL MgContext::param-changed ##### -->
37
@mgcontext: the object which received the signal.
40
<!-- ##### ARG MgContext:prop ##### -->
45
<!-- ##### STRUCT MgContextNode ##### -->
47
The #MgContext object creates a list of #MgContextNode structures which in a way "sort" the #MgParameter objects.
48
Each #MgParameter can either be a "free fill" parameter (which means any value is acceptable as long as it is
49
of the requested data type), or can depend on a list of values provided by a single #MgQfield object within a query.
52
Each #MgContextNode structure groups one or more parameters:
54
<listitem><para>exactly one #MgParameter object if that parameter is a "free fill" parameter</para></listitem>
55
<listitem><para>a list of one or more #MgParameter objects if all the parameters in the list are dependant
56
on values of a common SELECT Query</para></listitem>
60
@param: a pointer to the #MgParameter if it is a "free fill" parameter
61
@query: a pointer to the #MgQuery regulating the possible values of the parameters listed in the @params attribute
62
@params: the list of #MgParameter objects which are regulated by the @query query
63
@params_pos_in_query: a #GHashTable which holds, for each parameter in @params, the position in @query's resultset of the values which are acceptable for the parameter.
65
<!-- ##### FUNCTION mg_context_get_type ##### -->
73
<!-- ##### FUNCTION mg_context_new ##### -->
83
<!-- ##### FUNCTION mg_context_new_copy ##### -->
94
<!-- ##### FUNCTION mg_context_add_param ##### -->
103
<!-- ##### FUNCTION mg_context_merge_context_params ##### -->
112
<!-- ##### FUNCTION mg_context_is_coherent ##### -->
122
<!-- ##### FUNCTION mg_context_is_valid ##### -->
131
<!-- ##### FUNCTION mg_context_needs_user_input ##### -->
140
<!-- ##### FUNCTION mg_context_find_parameter_for_field ##### -->
150
<!-- ##### FUNCTION mg_context_find_node_for_param ##### -->
160
<!-- ##### FUNCTION mg_context_set_param_default_value ##### -->
170
<!-- ##### FUNCTION mg_context_set_param_default_alias ##### -->
180
<!-- ##### FUNCTION mg_context_get_param_default_value ##### -->