libgdamm Reference Documentation

Main Page Namespaces Book

# Gnome::Gda::DictConstraint Class Reference

Represents a constraint within a database. More...

Inheritance diagram for Gnome::Gda::DictConstraint:

[legend]
List of all members.

## Public Member Functions

bool | equal (const Glib::RefPtr<const DictConstraint>& cstr2) const
| Compares two Gda::DictConstraint objects to see if they are equal, without taking into account the name of the constraints or weather they are user or system defined.
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.
Glib::RefPtr<const DictTable> | fkey_get_ref_table () const
| Get the Gda::DictTable at the other end of the foreign key relation represented by this constraint.
Glib::RefPtr<DictTable> | fkey_get_ref_table ()
| Get the Gda::DictTable at the other end of the foreign key relation represented by this constraint.
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_set_fields (const GSList* pairs)
| Sets the field pairs which make the foreign key represented by cstr.
DictConstraintType | get_constraint_type () const
| Get the type of constraint the cstr object represents.
Glib::RefPtr<const DictTable> | get_table () const
| Get the table to which the constraint is attached.
Glib::RefPtr<DictTable> | get_table ()
| Get the table to which the constraint is attached.
const GdaDictConstraint* | gobj () const
| Provides access to the underlying C GObject.
GdaDictConstraint* | gobj ()
| 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.
Glib::RefPtr<const DictField> | not_null_get_field () const
Glib::RefPtr<DictField> | not_null_get_field ()
void | not_null_set_field (const Glib::RefPtr<DictField>& field)
Glib::SListHandle< Glib::RefPtr< const DictField > > | pkey_get_fields () const
| Get the list of fields composing the primary key constraint which cstr represents.
Glib::SListHandle< Glib::RefPtr< DictField > > | pkey_get_fields ()
| Get the list of fields composing the primary key constraint which cstr represents.
void | pkey_set_fields (const Glib::SListHandle<Glib::RefPtr<DictField>>& fields)
| Sets the fields which make the primary key represented by cstr.
Glib::PropertyProxy_ReadOnly< bool > | property_user_constraint () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> | property_user_constraint ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::SListHandle< Glib::RefPtr< const DictField > > | unique_get_fields () const
| Get the list of fields represented by this UNIQUE constraint.
Glib::SListHandle< Glib::RefPtr< DictField > > | unique_get_fields ()
| Get the list of fields represented by this UNIQUE constraint.
void | unique_set_fields (const Glib::SListHandle<Glib::RefPtr<DictField>>& fields)
bool | uses_field (const Glib::RefPtr<const DictField>& field) const
| Tests if field is part of the cstr constraint.
virtual | ~DictConstraint ()

## Static Public Member Functions

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

## Protected Member Functions

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

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr<Gnome::Gda::DictConstraint> | wrap (GdaDictConstraint* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## 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]`

bool Gnome::Gda::DictConstraint::equal | ( | const Glib::RefPtr<const DictConstraint>& | cstr2 | ) | const

Compares two Gda::DictConstraint objects to see if they are equal, without taking into account the name of the constraints or weather they are user or system defined.

Parameters:

  | cstr2 | The second Gda::DictConstraint to compare.

Returns:
  `true` if the two constraints are equal and `false` otherwise.

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.

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

Glib::SListHandle<Glib::RefPtr<const DictField>> Gnome::Gda::DictConstraint::pkey_get_fields | ( |  | ) | const

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.

Glib::SListHandle<Glib::RefPtr<DictField>> 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 Glib::SListHandle<Glib::RefPtr<DictField>>& | 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.

Glib::PropertyProxy_ReadOnly<bool> Gnome::Gda::DictConstraint::property_user_constraint | ( |  | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gnome::Gda::DictConstraint::property_user_constraint | ( |  | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::SListHandle<Glib::RefPtr<const DictField>> 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.

Glib::SListHandle<Glib::RefPtr<DictField>> Gnome::Gda::DictConstraint::unique_get_fields | ( |  | ) |

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 Glib::SListHandle<Glib::RefPtr<DictField>>& | 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]`

A Glib::wrap() method for this object.

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:

- dictconstraint.h