class GLib::Relation
- GLib::Relation
- Reference
- Object
Overview
A GRelation is a table of data which can be indexed on any number
of fields, rather like simple database tables. A GRelation contains
a number of records, called tuples. Each record contains a number of
fields. Records are not ordered, so it is not possible to find the
record at a particular index.
Note that GRelation tables are currently limited to 2 fields.
To create a GRelation, use GLib::Relation.new.
To specify which fields should be indexed, use GLib::Relation#index.
Note that this must be called before any tuples are added to the
GRelation.
To add records to a GRelation use GLib::Relation#insert.
To determine if a given record appears in a GRelation, use
GLib::Relation#exists. Note that fields are compared directly, so
pointers must point to the exact same position (i.e. different
copies of the same string will not match.)
To count the number of records which have a particular value in a
given field, use GLib::Relation#count.
To get all the records which have a particular value in a given
field, use GLib::Relation#select. To access fields of the resulting
records, use GLib::Tuples#index. To free the resulting records use
GLib::Tuples#destroy.
To delete all records which have a particular value in a given
field, use GLib::Relation#delete.
To destroy the GRelation, use GLib::Relation#destroy.
To help debug GRelation objects, use GLib::Relation#print.
GRelation has been marked as deprecated, since this API has never
been fully implemented, is not very actively maintained and rarely
used.
Defined in:
lib/gi-crystal/src/auto/g_lib-2.0/relation.crConstructors
Instance Method Summary
-
#count(key : Pointer(Void) | Nil, field : Int32) : Int32
DEPRECATED
-
#delete(key : Pointer(Void) | Nil, field : Int32) : Int32
DEPRECATED
-
#destroy : Nil
DEPRECATED
-
#print : Nil
DEPRECATED
- #to_unsafe : Pointer(Void)