Gnome::Gda::DictConstraint Class Reference

Represents a constraint within a database. More...

#include <dictconstraint.h>

Inheritance diagram for Gnome::Gda::DictConstraint:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~DictConstraint ()
GdaDictConstraint* gobj ()
 Provides access to the underlying C GObject.
const GdaDictConstraint* gobj () const
 Provides access to the underlying C GObject.
GdaDictConstraint* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
DictConstraintType get_constraint_type () const
 Get the type of constraint the cstr object represents.
Glib::RefPtr<DictTableget_table ()
 Get the table to which the constraint is attached.
Glib::RefPtr<const DictTableget_table () const
 Get the table to which the constraint is attached.
bool uses_field (const Glib::RefPtr<const DictField>& field) const
 Tests if field is part of the cstr constraint.
void pkey_set_fields (const GSList* fields)
 Sets the fields which make the primary key represented by cstr .
GSList* pkey_get_fields ()
 Get the list of fields composing the primary key constraint which cstr represents.
void fkey_set_fields (const GSList* pairs)
 Sets the field pairs which make the foreign key represented by cstr .
Glib::RefPtr<DictTablefkey_get_ref_table ()
 Get the Gda::DictTable at the other end of the foreign key relation represented by this constraint.
Glib::RefPtr<const DictTablefkey_get_ref_table () const
 Get the Gda::DictTable at the other end of the foreign key relation represented by this constraint.
GSList* fkey_get_fields () const
 Get the list of field pairs composing the foreign key constraint which cstr represents.
void fkey_set_actions (DictConstraintFkAction on_update, DictConstraintFkAction on_delete)
 Sets the actions undertaken by the DBMS when some actions occur on the referenced data.
void fkey_get_actions (DictConstraintFkAction& on_update, DictConstraintFkAction& on_delete)
 Get the actions undertaken by the DBMS when some actions occur on the referenced data.
void unique_set_fields (const GSList* fields)
GSList* unique_get_fields () const
 Get the list of fields represented by this UNIQUE constraint.
void not_null_set_field (const Glib::RefPtr<DictField>& field)
Glib::RefPtr<DictFieldnot_null_get_field ()
Glib::RefPtr<const DictFieldnot_null_get_field () const

Static Public Member Functions

static Glib::RefPtr<DictConstraintcreate (const Glib::RefPtr<DictTable>& table, DictConstraintType type)
static Glib::RefPtr<DictConstraintcreate (const Glib::RefPtr<DictDatabase>& db)

Protected Member Functions

 DictConstraint (const Glib::RefPtr<DictTable>& table, DictConstraintType type)
 DictConstraint (const Glib::RefPtr<DictDatabase>& db)

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gnome::Gda::DictConstraintwrap (GdaDictConstraint* object, bool take_copy=false)

Detailed Description

Represents a constraint within a database.

Any type of constraint in a database is represented by one instance of this class (see the possible types of constraints). As some constraints may not depend exclusively on a table, all the constraints are attached to the database itself.


Constructor & Destructor Documentation

virtual Gnome::Gda::DictConstraint::~DictConstraint (  )  [virtual]

Gnome::Gda::DictConstraint::DictConstraint ( const Glib::RefPtr<DictTable>&  table,
DictConstraintType  type 
) [explicit, protected]

Gnome::Gda::DictConstraint::DictConstraint ( const Glib::RefPtr<DictDatabase>&  db  )  [explicit, protected]


Member Function Documentation

static Glib::RefPtr<DictConstraint> Gnome::Gda::DictConstraint::create ( const Glib::RefPtr<DictDatabase>&  db  )  [static]

static Glib::RefPtr<DictConstraint> Gnome::Gda::DictConstraint::create ( const Glib::RefPtr<DictTable>&  table,
DictConstraintType  type 
) [static]

void Gnome::Gda::DictConstraint::fkey_get_actions ( DictConstraintFkAction on_update,
DictConstraintFkAction on_delete 
)

Get the actions undertaken by the DBMS when some actions occur on the referenced data.

Parameters:
on_update An address to store the action undertaken when an UPDATE occurs.
on_delete An address to store the action undertaken when a DELETE occurs.

GSList* Gnome::Gda::DictConstraint::fkey_get_fields (  )  const

Get the list of field pairs composing the foreign key constraint which cstr represents.

In the returned list, each pair item is allocated and it's up to the caller to free the list and each pair, and the reference count for each pointer to GObjects in each pair is NOT INCREASED, which means the caller of this function DOES NOT hold any reference on the mentionned GObjects (if he needs to, it has to call Glib::object_ref())

Returns:
A new list of Gda::DictConstraintFkeyPair pairs.

Glib::RefPtr<const DictTable> Gnome::Gda::DictConstraint::fkey_get_ref_table (  )  const

Get the Gda::DictTable at the other end of the foreign key relation represented by this constraint.

Returns:
The Gda::DictTable.

Glib::RefPtr<DictTable> Gnome::Gda::DictConstraint::fkey_get_ref_table (  ) 

Get the Gda::DictTable at the other end of the foreign key relation represented by this constraint.

Returns:
The Gda::DictTable.

void Gnome::Gda::DictConstraint::fkey_set_actions ( DictConstraintFkAction  on_update,
DictConstraintFkAction  on_delete 
)

Sets the actions undertaken by the DBMS when some actions occur on the referenced data.

Parameters:
on_update The action undertaken when an UPDATE occurs.
on_delete The action undertaken when a DELETE occurs.

void Gnome::Gda::DictConstraint::fkey_set_fields ( const GSList *  pairs  ) 

Sets the field pairs which make the foreign key represented by cstr .

All the field pairs must list a field which belong to the same Gda::DictTable to which the constraint is attached and a field which belongs to a Gda::DictTable which is different from the one just mentionned and which is within the same database. The pairs are of type Gda::DictConstraintFkeyPair.

Parameters:
pairs A list of Gda::DictField objects.

DictConstraintType Gnome::Gda::DictConstraint::get_constraint_type (  )  const

Get the type of constraint the cstr object represents.

Returns:
The constraint type.

Glib::RefPtr<const DictTable> Gnome::Gda::DictConstraint::get_table (  )  const

Get the table to which the constraint is attached.

Returns:
The Gda::DictTable.

Glib::RefPtr<DictTable> Gnome::Gda::DictConstraint::get_table (  ) 

Get the table to which the constraint is attached.

Returns:
The Gda::DictTable.

const GdaDictConstraint* Gnome::Gda::DictConstraint::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::Object.

GdaDictConstraint* Gnome::Gda::DictConstraint::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::Object.

GdaDictConstraint* Gnome::Gda::DictConstraint::gobj_copy (  ) 

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gnome::Gda::Object.

Glib::RefPtr<const DictField> Gnome::Gda::DictConstraint::not_null_get_field (  )  const

Glib::RefPtr<DictField> Gnome::Gda::DictConstraint::not_null_get_field (  ) 

void Gnome::Gda::DictConstraint::not_null_set_field ( const Glib::RefPtr<DictField>&  field  ) 

GSList* Gnome::Gda::DictConstraint::pkey_get_fields (  ) 

Get the list of fields composing the primary key constraint which cstr represents.

The returned list is allocated and must be de-allocated by the caller.

Returns:
A new list of fields.

void Gnome::Gda::DictConstraint::pkey_set_fields ( const GSList *  fields  ) 

Sets the fields which make the primary key represented by cstr .

All the fields must belong to the same Gda::DictTable to which the constraint is attached

Parameters:
fields A list of Gda::DictField objects.

GSList* Gnome::Gda::DictConstraint::unique_get_fields (  )  const

Get the list of fields represented by this UNIQUE constraint.

It's up to the caller to free the list.

Returns:
A new list of fields.

void Gnome::Gda::DictConstraint::unique_set_fields ( const GSList *  fields  ) 

bool Gnome::Gda::DictConstraint::uses_field ( const Glib::RefPtr<const DictField>&  field  )  const

Tests if field is part of the cstr constraint.

Parameters:
field A Gda::DictField object.
Returns:
true if cstr uses field .


Friends And Related Function Documentation

Glib::RefPtr<Gnome::Gda::DictConstraint> wrap ( GdaDictConstraint *  object,
bool  take_copy = false 
) [related]

Parameters:
object The C instance
take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.


The documentation for this class was generated from the following file:
Generated on Sat Feb 10 20:06:35 2007 for libgdamm by  doxygen 1.4.7