![]() |
![]() |
![]() |
Holyrel Library Reference Manual | ![]() |
---|
SortingSorting — Sorting. |
#include <libhrel/relation.h> HRelationSort; 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);
Strictly speaking, tuples in a relation are by definition unordered. While HRelationSort is a HRelation due to inheritance, it does not represent a relation.
typedef struct _HRelationSort HRelationSort;
A HRelation representing a "sorted 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 |
<< Restrict | Projection >> |