| GNOME Data Access 3.0 manual | ||||
|---|---|---|---|---|
GdaQueryCondition;
enum GdaQueryConditionType;
enum GdaQueryConditionOperator;
GdaQueryCondition* gda_query_condition_new (GdaQuery *query,
GdaQueryConditionType type);
GdaQueryCondition* gda_query_condition_new_copy (GdaQueryCondition *orig,
GHashTable *replacements);
GdaQueryCondition* gda_query_condition_new_from_sql (GdaQuery *query,
const gchar *sql_cond,
GSList **targets,
GError **error);
void gda_query_condition_set_cond_type (GdaQueryCondition *condition,
GdaQueryConditionType type);
GdaQueryConditionType gda_query_condition_get_cond_type (GdaQueryCondition *condition);
GSList* gda_query_condition_get_children (GdaQueryCondition *condition);
GdaQueryCondition* gda_query_condition_get_parent (GdaQueryCondition *condition);
GdaQueryCondition* gda_query_condition_get_child_by_xml_id
(GdaQueryCondition *condition,
const gchar *xml_id);
gboolean gda_query_condition_is_ancestor (GdaQueryCondition *condition,
GdaQueryCondition *ancestor);
gboolean gda_query_condition_is_leaf (GdaQueryCondition *condition);
gboolean gda_query_condition_node_add_child (GdaQueryCondition *condition,
GdaQueryCondition *child,
GError **error);
void gda_query_condition_node_del_child (GdaQueryCondition *condition,
GdaQueryCondition *child);
void gda_query_condition_leaf_set_operator
(GdaQueryCondition *condition,
GdaQueryConditionOperator op,
GdaQueryField *field);
GdaQueryField* gda_query_condition_leaf_get_operator
(GdaQueryCondition *condition,
GdaQueryConditionOperator op);
gboolean gda_query_condition_represents_join (GdaQueryCondition *condition,
GdaQueryTarget **target1,
GdaQueryTarget **target2,
gboolean *is_equi_join);
gboolean gda_query_condition_represents_join_strict
(GdaQueryCondition *condition,
GdaQueryTarget **target1,
GdaQueryTarget **target2);
GSList* gda_query_condition_get_main_conditions
(GdaQueryCondition *condition);
GSList* gda_query_condition_get_ref_objects_all
(GdaQueryCondition *cond);
"cond-type" gint : Read / Write "join" GdaQueryJoin* : Read / Write "query" GdaQuery* : Read / Write / Construct Only
This object represents a condition within a query. Usually there is one such object to express a WHERE condition and sometimes a GdaQueryJoin object con contain one as well to express a specific joinning condition.
There are two types of conditions: 'node' conditions (AND, OR, NOT), where there are one or more children condition and 'leaf' conditions, where there are only operands.
typedef struct _GdaQueryCondition GdaQueryCondition;
GdaQueryCondition is deprecated and should not be used in newly-written code.
typedef enum {
GDA_QUERY_CONDITION_NODE_AND,
GDA_QUERY_CONDITION_NODE_OR,
GDA_QUERY_CONDITION_NODE_NOT,
GDA_QUERY_CONDITION_LEAF_EQUAL,
GDA_QUERY_CONDITION_LEAF_DIFF,
GDA_QUERY_CONDITION_LEAF_SUP,
GDA_QUERY_CONDITION_LEAF_SUPEQUAL,
GDA_QUERY_CONDITION_LEAF_INF,
GDA_QUERY_CONDITION_LEAF_INFEQUAL,
GDA_QUERY_CONDITION_LEAF_LIKE,
GDA_QUERY_CONDITION_LEAF_SIMILAR,
GDA_QUERY_CONDITION_LEAF_REGEX,
GDA_QUERY_CONDITION_LEAF_REGEX_NOCASE,
GDA_QUERY_CONDITION_LEAF_NOT_REGEX,
GDA_QUERY_CONDITION_LEAF_NOT_REGEX_NOCASE,
GDA_QUERY_CONDITION_LEAF_IN,
GDA_QUERY_CONDITION_LEAF_BETWEEN,
GDA_QUERY_CONDITION_TYPE_UNKNOWN
} GdaQueryConditionType;
GdaQueryConditionType is deprecated and should not be used in newly-written code.
typedef enum {
GDA_QUERY_CONDITION_OP_LEFT = 0,
GDA_QUERY_CONDITION_OP_RIGHT = 1,
GDA_QUERY_CONDITION_OP_RIGHT2 = 2
} GdaQueryConditionOperator;
GdaQueryConditionOperator is deprecated and should not be used in newly-written code.
GdaQueryCondition* gda_query_condition_new (GdaQuery *query, GdaQueryConditionType type);
gda_query_condition_new is deprecated and should not be used in newly-written code.
Creates a new GdaQueryCondition object
|
a GdaQuery object |
|
the condition type |
Returns : |
the newly created object |
GdaQueryCondition* gda_query_condition_new_copy (GdaQueryCondition *orig, GHashTable *replacements);
gda_query_condition_new_copy is deprecated and should not be used in newly-written code.
This is a copy constructor
|
a GdaQueryCondition to copy |
|
a hash table to store replacements, or NULL
|
Returns : |
the new object |
GdaQueryCondition* gda_query_condition_new_from_sql (GdaQuery *query, const gchar *sql_cond, GSList **targets, GError **error);
gda_query_condition_new_from_sql is deprecated and should not be used in newly-written code.
Creates a new GdaQueryCondition object, which references other objects of query,
from the sql_cond statement.
|
a GdaQuery object |
|
a SQL statement representing a valid condition |
|
location to store a list of targets used by the new condition (and its children), or NULL
|
|
location to store error, or NULL
|
Returns : |
a new GdaQueryCondition, or NULL if there was an error in sql_cond
|
void gda_query_condition_set_cond_type (GdaQueryCondition *condition, GdaQueryConditionType type);
gda_query_condition_set_cond_type is deprecated and should not be used in newly-written code.
Sets the kind of condition condition represents. If type implies a node condition and
condition currently represents a leaf, or if type implies a leaf condition and
condition currently represents a node, then condition is changed without any error.
|
a GdaQueryCondition object |
|
GdaQueryConditionType gda_query_condition_get_cond_type (GdaQueryCondition *condition);
gda_query_condition_get_cond_type is deprecated and should not be used in newly-written code.
Get the type of condition
|
a GdaQueryCondition object |
Returns : |
the type |
GSList* gda_query_condition_get_children (GdaQueryCondition *condition);
gda_query_condition_get_children is deprecated and should not be used in newly-written code.
Get a list of GdaQueryCondition objects which are children of condition
|
a GdaQueryCondition object |
Returns : |
a new list of GdaQueryCondition objects |
GdaQueryCondition* gda_query_condition_get_parent (GdaQueryCondition *condition);
gda_query_condition_get_parent is deprecated and should not be used in newly-written code.
Get the GdaQueryCondition object which is parent of condition
|
a GdaQueryCondition object |
Returns : |
the parent object, or NULL
|
GdaQueryCondition* gda_query_condition_get_child_by_xml_id (GdaQueryCondition *condition, const gchar *xml_id);
gda_query_condition_get_child_by_xml_id is deprecated and should not be used in newly-written code.
Get a pointer to a GdaQueryCondition child from its XML Id
|
a GdaQueryCondition object |
|
the XML Id of the requested GdaQueryCondition child |
Returns : |
the GdaQueryCondition object, or NULL if not found
|
gboolean gda_query_condition_is_ancestor (GdaQueryCondition *condition, GdaQueryCondition *ancestor);
gda_query_condition_is_ancestor is deprecated and should not be used in newly-written code.
Tests if ancestor is an ancestor of condition
|
a GdaQueryCondition object |
|
a GdaQueryCondition object |
Returns : |
TRUE if ancestor is an ancestor of condition
|
gboolean gda_query_condition_is_leaf (GdaQueryCondition *condition);
gda_query_condition_is_leaf is deprecated and should not be used in newly-written code.
Tells if condition is a leaf condition (not AND, OR, NOT, etc)
|
a GdaQueryCondition object |
Returns : |
TRUE if condition is a leaf condition
|
gboolean gda_query_condition_node_add_child (GdaQueryCondition *condition, GdaQueryCondition *child, GError **error);
gda_query_condition_node_add_child is deprecated and should not be used in newly-written code.
Adds a child to condition; this is possible only if condition is a node type (AND, OR, etc)
|
a GdaQueryCondition object |
|
a GdaQueryCondition object |
|
location to store error, or NULL
|
Returns : |
TRUE if no error occurred |
void gda_query_condition_node_del_child (GdaQueryCondition *condition, GdaQueryCondition *child);
gda_query_condition_node_del_child is deprecated and should not be used in newly-written code.
Removes a child from condition; this is possible only if condition is a node type (AND, OR, etc)
|
a GdaQueryCondition object |
|
a GdaQueryCondition object |
void gda_query_condition_leaf_set_operator
(GdaQueryCondition *condition,
GdaQueryConditionOperator op,
GdaQueryField *field);
gda_query_condition_leaf_set_operator is deprecated and should not be used in newly-written code.
|
|
|
|
|
GdaQueryField* gda_query_condition_leaf_get_operator (GdaQueryCondition *condition, GdaQueryConditionOperator op);
gda_query_condition_leaf_get_operator is deprecated and should not be used in newly-written code.
Get one of condition's operators.
|
a GdaQueryCondition object |
|
which oparetor is concerned |
Returns : |
the requested GdaQueryField object |
gboolean gda_query_condition_represents_join (GdaQueryCondition *condition, GdaQueryTarget **target1, GdaQueryTarget **target2, gboolean *is_equi_join);
gda_query_condition_represents_join is deprecated and should not be used in newly-written code.
Tells if condition represents a join condition: it is a condition (within a GdaQuery object)
for which the only GdaQueryFieldField fields taking part in the condition are from two distincts
GdaQueryTarget objects. Such conditions can be assigned to a GdaQueryJoin object using the
gda_query_join_set_condition() or gda_query_join_set_condition_from_fkcons() methods.
Additionnaly, if condition is a join condition, and if target1 and target2 are not NULL
then they are set to point to the two GdaQueryTarget objects taking part in the condition. In this
case target1 and target2 wil hold non NULL values.
In a similar way, if is_equi_join is not NULL, then it will be set to TRUE if the join
condition is an equi join (that is the only comparison operator is the equal sign and there are
only AND operators in the condition).
If condition is not a join condition, then target1, target2 and is_equi_join are left
untouched.
|
a GdaQueryCondition object |
|
place to store one of the targets, or NULL
|
|
place to store the other target, or NULL
|
|
place to store if the join is an equi join |
Returns : |
TRUE if condition is a join condition
|
gboolean gda_query_condition_represents_join_strict (GdaQueryCondition *condition, GdaQueryTarget **target1, GdaQueryTarget **target2);
gda_query_condition_represents_join_strict is deprecated and should not be used in newly-written code.
Tells if condition represents a strict join condition: it is a join condition as defined for the
gda_query_condition_represents_join() method, but where the condition is either "target1.field1=target2.field2"
or a list of such conditions conjuncted by the AND operator.
If condition is not a join condition, then target1 and target2 are left
untouched.
|
a GdaQueryCondition object |
|
place to store one of the targets, or NULL
|
|
place to store the other target, or NULL
|
Returns : |
TRUE if condition is a strict join condition
|
GSList* gda_query_condition_get_main_conditions (GdaQueryCondition *condition);
gda_query_condition_get_main_conditions is deprecated and should not be used in newly-written code.
Makes a list of all the conditions which
are always verified by condition when it returns TRUE when evaluated.
Basically the returned list lists the atomic conditions which are AND'ed
together to form the complex condition.
Examples: if condition is:
"A and B" then the list will contains {A, B}
"A and (B or C)" it will contain {A, B or C}
"A and (B and not C)", it will contain {A, B, not C}
|
a GdaQueryCondition object |
Returns : |
a new list of GdaQueryCondition objects |
GSList* gda_query_condition_get_ref_objects_all (GdaQueryCondition *cond);
gda_query_condition_get_ref_objects_all is deprecated and should not be used in newly-written code.
Get a complete list of the objects referenced by cond,
including its descendants (unlike the gda_referer_get_ref_objects()
function applied to cond).
|
a GdaQueryCondition object |
Returns : |
a new list of referenced objects |