libgdamm Reference Documentation

Main Page Namespaces Book

# Gnome::Gda::DictField Class Reference

Represents a field in a table or a view in the database. More...

Inheritance diagram for Gnome::Gda::DictField:

[legend]
List of all members.

## Public Member Functions

DictFieldAttribute | get_attributes () const
GSList* | get_constraints ()
| Get all the constraints which impact the given field.
Value | get_default_value () const
int | get_length () const
| Get the length of a field.
int | get_scale () const
| Get the scale of a field.
const GdaDictField* | gobj () const
| Provides access to the underlying C GObject.
GdaDictField* | gobj ()
| Provides access to the underlying C GObject.
GdaDictField* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool | is_fkey_alone () const
| Get field's extra attributes.
bool | is_fkey_part () const
| Test if field is part of a foreign key constraint.
bool | is_null_allowed () const
| Test if field can be `0` or not.
bool | is_pkey_alone () const
| Test if field is alone a primary key constraint.
bool | is_pkey_part () const
| Test if field is part of a primary key constraint.
void | set_attributes (DictFieldAttribute attributes)
void | set_default_value (const Value& value)
| Sets (or replace) the default value for the field.
void | set_length (int length)
void | set_scale (int length)
virtual | ~DictField ()

## Static Public Member Functions

static Glib::RefPtr<DictField> | create (const Glib::RefPtr<Dict>& dict, const Glib::RefPtr<DictType>& type)

## Protected Member Functions

| DictField (const Glib::RefPtr<Dict>& dict, const Glib::RefPtr<DictType>& type)

## Related Functions

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

## Detailed Description

Represents a field in a table or a view in the database.

Unlike DataModelArray, this data model implementation stores the Row in a hash table. So it only retrieves from the database backend exactly the requested rows (while in DataModelArray you have to retrieve all the rows until the one requested).

## Constructor & Destructor Documentation

virtual Gnome::Gda::DictField::~DictField | ( |  | ) | `[virtual]`

Gnome::Gda::DictField::DictField | ( | const Glib::RefPtr<Dict>& | dict,
|  | const Glib::RefPtr<DictType>& | type |
| ) |  |  | `[explicit, protected]`

## Member Function Documentation

static Glib::RefPtr<DictField> Gnome::Gda::DictField::create | ( | const Glib::RefPtr<Dict>& | dict,
|  | const Glib::RefPtr<DictType>& | type |
| ) |  |  | `[static]`

DictFieldAttribute Gnome::Gda::DictField::get_attributes | ( |  | ) | const

GSList* Gnome::Gda::DictField::get_constraints | ( |  | ) |

Get all the constraints which impact the given field.

Constraints are of several type: NOT `0`, primary key, foreign key, check constrains

Returns:
  A new list of Gda::DictConstraint objects.

Value Gnome::Gda::DictField::get_default_value | ( |  | ) | const

int Gnome::Gda::DictField::get_length | ( |  | ) | const

Get the length of a field.

Returns:
  The size of the corresponding data type has a fixed size, or -1.

int Gnome::Gda::DictField::get_scale | ( |  | ) | const

Get the scale of a field.

Returns:
  The size of the corresponding data type has a fixed size, or -1.

const GdaDictField* Gnome::Gda::DictField::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::Object.

GdaDictField* Gnome::Gda::DictField::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::Object.

GdaDictField* Gnome::Gda::DictField::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.

bool Gnome::Gda::DictField::is_fkey_alone | ( |  | ) | const

Get field's extra attributes.

The attributes is an OR'ed value of all the possible values in Gda::DictFieldAttribute.

Returns:
  The new attributes value.

bool Gnome::Gda::DictField::is_fkey_part | ( |  | ) | const

Test if field is part of a foreign key constraint.

bool Gnome::Gda::DictField::is_null_allowed | ( |  | ) | const

Test if field can be `0` or not.

bool Gnome::Gda::DictField::is_pkey_alone | ( |  | ) | const

Test if field is alone a primary key constraint.

bool Gnome::Gda::DictField::is_pkey_part | ( |  | ) | const

Test if field is part of a primary key constraint.

void Gnome::Gda::DictField::set_attributes | ( | DictFieldAttribute | attributes | ) |

void Gnome::Gda::DictField::set_default_value | ( | const Value& | value | ) |

Sets (or replace) the default value for the field.

WARNING: the default value's data type can be different from the field's data type (this is the case for example if the default value is a function like Postgres's default value for the SERIAL data type).

Parameters:

  | value | A Value value or `0`.

void Gnome::Gda::DictField::set_length | ( | int | length | ) |

void Gnome::Gda::DictField::set_scale | ( | int | length | ) |

## Friends And Related Function Documentation

Glib::RefPtr<Gnome::Gda::DictField> wrap | ( | GdaDictField * | 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:

- dictfield.h