![]() |
![]() |
![]() |
Holyrel Library Reference Manual | ![]() |
---|
OperatorsOperators — Relational operators. |
#include <libhrel/relation.h> gboolean (*HTuplePredFunc) (HTuple *tuple, gpointer user_data); HRelation* h_relation_restrict (HRelation *relation, HTuplePredFunc predicate_func, gpointer user_data); HRelation* h_relation_restrict_attrs (HRelation *relation, ...); HRelation* h_relation_restrict_attrs_l (HRelation *relation, GSList *list); HRelation* h_relation_sort (HRelation *relation, GCompareDataFunc compare_func, gpointer user_data); HRelation* h_relation_sort_by_attrs (HRelation *relation, ...); HRelation* h_relation_sort_by_attrs_l (HRelation *relation, GSList *list); HRelation* h_relation_project (HRelation *relation, ...); HRelation* h_relation_project_l (HRelation *relation, GSList *list); HRelation* h_relation_union (HRelation *relation1, HRelation *relation2); HRelation* h_relation_diff (HRelation *relation1, HRelation *relation2); HRelation* h_relation_intersect (HRelation *relation1, HRelation *relation2);
gboolean (*HTuplePredFunc) (HTuple *tuple, gpointer user_data);
A HTuple predicate function.
tuple : |
a HTuple |
user_data : |
user data |
Returns : | either TRUE or FALSE |
HRelation* h_relation_restrict (HRelation *relation, HTuplePredFunc predicate_func, gpointer user_data);
Restricts relation
to the set of tuples evaluating to TRUE with
predicate_func
.
HRelation* h_relation_restrict_attrs (HRelation *relation, ...);
Restricts relation
to the set of tuples which contain the
attribute values listed.
relation : |
relation to restrict |
... : |
name and value of an attribute, followed by another and so
on, then a NULL .
|
Returns : | restricted relation |
HRelation* h_relation_restrict_attrs_l (HRelation *relation, GSList *list);
A variation of h_relation_restrict_attrs()
, taking a GSList for
the attribute list.
relation : |
relation to restrict |
list : |
list of attribute names and their values |
Returns : | restricted relation |
HRelation* h_relation_sort (HRelation *relation, GCompareDataFunc compare_func, gpointer user_data);
Creates a sorted relation.
relation : |
a relation to sort |
compare_func : |
function to compare a pair of tuples in relation
|
user_data : |
Custom data passed to compare_func
|
Returns : | sorted relation |
HRelation* h_relation_sort_by_attrs (HRelation *relation, ...);
Creates a relation sorted by attributes. Each pair of tuples are compared attribute by attribute in the order listed.
relation : |
relation to sort |
... : |
name of first attribute, followed by the second and so on,
then a NULL
|
Returns : | sorted relation |
HRelation* h_relation_sort_by_attrs_l (HRelation *relation, GSList *list);
A variation of h_relation_sort_by_attrs()
, taking a GSList for the
attribute name list.
relation : |
relation to sort |
list : |
list of attribute names |
Returns : | sorted relation |
HRelation* h_relation_project (HRelation *relation, ...);
Creates a relation on relation
projected over a set of
attributes.
relation : |
relation to project |
... : |
name of an attribute, followed by another and so on, then a
NULL
|
Returns : | projected relation |
HRelation* h_relation_project_l (HRelation *relation, GSList *list);
A variation of h_relation_project()
taking a GSList of attribute
names.
relation : |
relation to project |
list : |
list of attribute names |
Returns : | projected relation |
HRelation* h_relation_union (HRelation *relation1, HRelation *relation2);
Creates the union of two relations.
HRelation* h_relation_diff (HRelation *relation1, HRelation *relation2);
Creates the difference of two relations.
<< Base Relation | Indexes >> |