## GnomeDbTableField

GnomeDbTableField — Represents a field in a table or a view in the database

## Synopsis

                GnomeDbTableField;
    GObject*    gnome_db_table_field_new        (GnomeDbDict *dict,
                                                 GnomeDbServerDataType *type);
    void        gnome_db_table_field_set_length (GnomeDbTableField *field,
                                                 gint length);
    gint        gnome_db_table_field_get_length (GnomeDbTableField *field);
    void        gnome_db_table_field_set_scale  (GnomeDbTableField *field,
                                                 gint length);
    gint        gnome_db_table_field_get_scale  (GnomeDbTableField *field);
    GSList*     gnome_db_table_field_get_constraints
                                                (GnomeDbTableField *field);
    void        gnome_db_table_field_set_data_type
                                                (GnomeDbTableField *field,
                                                 GnomeDbServerDataType *type);
    void        gnome_db_table_field_set_default_value
                                                (GnomeDbTableField *field,
                                                 const GdaValue *value);
    const GdaValue* gnome_db_table_field_get_default_value
                                                (GnomeDbTableField *field);
    gboolean    gnome_db_table_field_is_null_allowed
                                                (GnomeDbTableField *field);
    gboolean    gnome_db_table_field_is_pkey_part
                                                (GnomeDbTableField *field);
    gboolean    gnome_db_table_field_is_pkey_alone
                                                (GnomeDbTableField *field);
    gboolean    gnome_db_table_field_is_fkey_part
                                                (GnomeDbTableField *field);
    gboolean    gnome_db_table_field_is_fkey_alone
                                                (GnomeDbTableField *field);

## Object Hierarchy

      GObject
       +----GnomeDbBase
             +----GnomeDbTableField

## Implemented Interfaces

GnomeDbTableField implements GnomeDbXmlStorage, GnomeDbRenderer and GnomeDbField.

## Properties

      "db-table"             gpointer              : Read / Write

## Signals

    "templ-signal"
                void        user_function      (GnomeDbTableField *dbtablefield,
                                                gpointer user_data);

## Description

It implements the following interfaces: GnomeDbField, GnomeDbXmlStorage and GnomeDbRenderer.

## Details

### GnomeDbTableField

    typedef struct _GnomeDbTableField GnomeDbTableField;

### gnome_db_table_field_new ()

    GObject*    gnome_db_table_field_new        (GnomeDbDict *dict,
                                                 GnomeDbServerDataType *type);

Creates a new GnomeDbTableField object

`dict` : | a GnomeDbDict object
`type` : | a GnomeDbServerDataType object (the field's type)
Returns : | the new object

### gnome_db_table_field_set_length ()

    void        gnome_db_table_field_set_length (GnomeDbTableField *field,
                                                 gint length);

`field` : |
`length` : |

### gnome_db_table_field_get_length ()

    gint        gnome_db_table_field_get_length (GnomeDbTableField *field);

Get the length of a field.

`field` : | a GnomeDbTableField object
Returns : | the size of the corresponding data type has a fixed size, or -1

### gnome_db_table_field_set_scale ()

    void        gnome_db_table_field_set_scale  (GnomeDbTableField *field,
                                                 gint length);

`field` : |
`length` : |

### gnome_db_table_field_get_scale ()

    gint        gnome_db_table_field_get_scale  (GnomeDbTableField *field);

Get the scale of a field.

`field` : | a GnomeDbTableField object
Returns : | the size of the corresponding data type has a fixed size, or -1

### gnome_db_table_field_get_constraints ()

    GSList*     gnome_db_table_field_get_constraints
                                                (GnomeDbTableField *field);

Get all the constraints which impact the given field. Constraints are of several type: NOT NULL, primary key, foreign key, check constrains

`field` : | a GnomeDbTableField object
Returns : | a new list of GnomeDbConstraint objects

### gnome_db_table_field_set_data_type ()

    void        gnome_db_table_field_set_data_type
                                                (GnomeDbTableField *field,
                                                 GnomeDbServerDataType *type);

Sets the data type of the field

`field` : | a GnomeDbTableField object
`type` : | a GnomeDbServerDataType object

### gnome_db_table_field_set_default_value ()

    void        gnome_db_table_field_set_default_value
                                                (GnomeDbTableField *field,
                                                 const GdaValue *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).

`field` : | a GnomeDbTableField object
`value` : | a GdaValue value or NULL

### gnome_db_table_field_get_default_value ()

    const GdaValue* gnome_db_table_field_get_default_value
                                                (GnomeDbTableField *field);

Get the default value for the field if ne exists

`field` : | a GnomeDbTableField object
Returns : | the default value

### gnome_db_table_field_is_null_allowed ()

    gboolean    gnome_db_table_field_is_null_allowed
                                                (GnomeDbTableField *field);

Test if `field` can be `NULL` or not

`field` : | a GnomeDbTableField object
Returns : |

### gnome_db_table_field_is_pkey_part ()

    gboolean    gnome_db_table_field_is_pkey_part
                                                (GnomeDbTableField *field);

Test if `field` is part of a primary key constraint

`field` : | a GnomeDbTableField object
Returns : |

### gnome_db_table_field_is_pkey_alone ()

    gboolean    gnome_db_table_field_is_pkey_alone
                                                (GnomeDbTableField *field);

Test if `field` is alone a primary key constraint

`field` : | a GnomeDbTableField object
Returns : |

### gnome_db_table_field_is_fkey_part ()

    gboolean    gnome_db_table_field_is_fkey_part
                                                (GnomeDbTableField *field);

Test if `field` is part of a foreign key constraint

`field` : | a GnomeDbTableField object
Returns : |

### gnome_db_table_field_is_fkey_alone ()

    gboolean    gnome_db_table_field_is_fkey_alone
                                                (GnomeDbTableField *field);

Get `field`'s extra attributes. The `attributes` is an OR'ed value of all the possible values in GnomeDbTableFieldAttribute.

`field` : | a GnomeDbTableField object
Returns : | the new attributes value

## Property Details

### The "`db-table`" property

      "db-table"             gpointer              : Read / Write

## Signal Details

### The "templ-signal" signal

    void        user_function                  (GnomeDbTableField *dbtablefield,
                                                gpointer user_data);

`dbtablefield` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.