| Top |
| #define | GOM_SORTING_CONST() |
| gchar * | gom_sorting_get_sql () |
| GomSorting * | gom_sorting_new () |
| void | gom_sorting_add () |
#define GOM_SORTING_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOM_TYPE_SORTING, GomSorting const))
GomSorting * gom_sorting_new (GType first_resource_type,const gchar *first_property_name,GomSortingMode first_sorting_mode,...);
Creates a new GomSorting to instance.
This is useful to sort query results, as GomSorting knows how to return the proper "ORDER BY" SQL statements.
Example:
1 2 3 4 5 6 |
GomSorting *sorting = gom_sorting_new(EPISODE_TYPE_RESOURCE, "season-number", GOM_SORTING_DESCENDING, EPISODE_TYPE_RESOURCE, "episode-number", GOM_SORTING_ASCENDING); |
The above example maps to the following SQL statement:
1 |
ORDER BY 'episodes'.'season-number' DESC, 'episodes'.'episode-number' |
[constructor]
first_resource_type |
A subclass of GomResource. |
|
first_property_name |
A string. |
|
first_sorting_mode |
A GomSortingMode. |
|
... |
Additional triples of resource_type/property_name/sorting_mode,
followed by |
void gom_sorting_add (GomSorting *sorting,GType resource_type,const gchar *property_name,GomSortingMode sorting_mode);
Add a new ORDER BY clause to the sorting object.
This allows chaining ORDER BY clauses, adding them one at a time, rather than passing them all to the constructor.
Example:
1 2 3 4 5 |
GomSorting *sorting = g_object_new (GOM_TYPE_SORTING, NULL); gom_sorting_add (sorting, EPISODE_TYPE_RESOURCE, "season-number", GOM_SORTING_DESCENDING); gom_sorting_add (sorting, EPISODE_TYPE_RESOURCE, "episode-number", GOM_SORTING_ASCENDING); |
The above example maps to the following SQL statement:
1 |
ORDER BY 'episodes'.'season-number' DESC, 'episodes'.'episode-number' |
sorting |
A GomSorting. |
|
resource_type |
A subclass of GomResource. |
|
property_name |
A string. |
|
sorting_mode |
A GomSortingMode. |