![]() |
![]() |
![]() |
Holyrel Library Reference Manual | ![]() |
---|
Base RelationBase Relation — Base relation. |
#include <libhrel/relation.h> HRelationBase; HRelation* h_relation_base_new (const gchar *name, const gchar *description, ...); gboolean h_relation_base_insert_tuple (HRelationBase *relation, HTuple *tuple); gboolean h_relation_base_insert_tuplev (HRelationBase *relation, ...); gboolean h_relation_base_delete_tuple (HRelationBase *relation, HTuple *key); gboolean h_relation_base_delete_tuplev (HRelationBase *relation, ...); HTuple* h_relation_base_get_tuple (HRelationBase *relation, HTuple *key); HTuple* h_relation_base_get_tuplev (HRelationBase *relation, ...); GSList* h_relation_base_get_primary_key (HRelationBase *relation);
typedef struct _HRelationBase HRelationBase;
A HRelation representing a base relation.
HRelation* h_relation_base_new (const gchar *name, const gchar *description, ...);
Returns a new base relation with name name
, description
description
, specified attributes and primary key attributes.
name : |
name |
description : |
description |
... : |
name and type of an attribute, followed by another and so on
then NULL , followed by the name of a primary key attribute,
followed by another and so on, then NULL .
|
Returns : | a base relation or NULL
|
gboolean h_relation_base_insert_tuple (HRelationBase *relation, HTuple *tuple);
Inserts a tuple into relation
.
relation : |
a HRelationBase |
tuple : |
a HTuple to insert |
Returns : | TRUE if tuple was successfully inserted, FALSE
otherwise
|
gboolean h_relation_base_insert_tuplev (HRelationBase *relation, ...);
Inserts a tuple into relation
.
relation : |
a HRelationBase |
... : |
An attribute name, followed by its corresponding value, followed by another attribute name, and so on. |
Returns : | TRUE if tuple was successfully inserted, FALSE otherwise |
gboolean h_relation_base_delete_tuple (HRelationBase *relation, HTuple *key);
Deletes a tuple in relation
that has the primary key key
.
relation : |
a HRelationBase |
key : |
primary key value |
Returns : | TRUE if tuple was deleted, FALSE if no such tuple exists. |
gboolean h_relation_base_delete_tuplev (HRelationBase *relation, ...);
Deletes the tuple in relation
that has the specified primary key.
relation : |
a HRelationBase |
... : |
name and value of first key attribute, followed by the second
and so on, then NULL .
|
Returns : | TRUE if tuple was deleted, FALSE if no such tuple exists. |
HTuple* h_relation_base_get_tuple (HRelationBase *relation, HTuple *key);
Returns a tuple in relation
that has the primary key key
.
relation : |
a HRelationBase |
key : |
primary key value |
Returns : | a HTuple storing the tuple or NULL if no tuples have
the specified key.
|
HTuple* h_relation_base_get_tuplev (HRelationBase *relation, ...);
Returns a tuple in relation
that has the primary key key
.
relation : |
a HRelationBase |
... : |
name and value of first key attribute, followed by the second
and so on, then NULL
|
Returns : | a HTuple storing the tuple or NULL if no tuples have
the specified key.
|
GSList* h_relation_base_get_primary_key (HRelationBase *relation);
Returns the primary key of relation
.
relation : |
a HRelationBase |
Returns : | primary key (must not be freed) |
<< Relation | Restrict >> |