Base Relation

Base Relation — Base relation.

Synopsis


#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);

Object Hierarchy


  GObject
   +----HRelation
         +----HRelationBase

Description

Details

HRelationBase

typedef struct _HRelationBase HRelationBase;

A HRelation representing a base relation.


h_relation_base_new ()

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

h_relation_base_insert_tuple ()

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

h_relation_base_insert_tuplev ()

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

h_relation_base_delete_tuple ()

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.

h_relation_base_delete_tuplev ()

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.

h_relation_base_get_tuple ()

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.

h_relation_base_get_tuplev ()

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.

h_relation_base_get_primary_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)