## GdaDictField GdaDictField — Represents a field in a table or a view in the database |

## Synopsis

                        GdaDictField;
    enum                GdaDictFieldAttribute;
    GObject*            gda_dict_field_new                  (GdaDict *dict,
                                                             GdaDictType *type);
    void                gda_dict_field_set_length           (GdaDictField *field,
                                                             gint length);
    gint                gda_dict_field_get_length           (GdaDictField *field);
    void                gda_dict_field_set_scale            (GdaDictField *field,
                                                             gint length);
    gint                gda_dict_field_get_scale            (GdaDictField *field);
    GSList*             gda_dict_field_get_constraints      (GdaDictField *field);
    void                gda_dict_field_set_default_value    (GdaDictField *field,
                                                             const GValue *value);
    const GValue*       gda_dict_field_get_default_value    (GdaDictField *field);
    gboolean            gda_dict_field_is_null_allowed      (GdaDictField *field);
    gboolean            gda_dict_field_is_pkey_part         (GdaDictField *field);
    gboolean            gda_dict_field_is_pkey_alone        (GdaDictField *field);
    gboolean            gda_dict_field_is_fkey_part         (GdaDictField *field);
    gboolean            gda_dict_field_is_fkey_alone        (GdaDictField *field);
    void                gda_dict_field_set_attributes       (GdaDictField *field,
                                                             GdaDictFieldAttribute attributes);
    GdaDictFieldAttribute gda_dict_field_get_attributes     (GdaDictField *field);

## Object Hierarchy

      GObject
       +----GdaObject
             +----GdaDictField

## Implemented Interfaces

GdaDictField implements GdaXmlStorage, GdaEntityField and GdaRenderer.

## Properties

      "db-table"                 GdaDictTable*         : Read / Write
      "entry-plugin"             gchar*                : Read / Write

## Description

It implements the following interfaces: GdaEntityField, GdaXmlStorage and GdaRenderer.

## Details

### GdaDictField

    typedef struct _GdaDictField GdaDictField;

### enum GdaDictFieldAttribute

    typedef enum {
    	FIELD_AUTO_INCREMENT = 1 << 0
    } GdaDictFieldAttribute;

### gda_dict_field_new ()

    GObject*            gda_dict_field_new                  (GdaDict *dict,
                                                             GdaDictType *type);

Creates a new GdaDictField object

`dict` : | a GdaDict object
`type` : | a GdaDictType object (the field's type)
Returns : | the new object

### gda_dict_field_set_length ()

    void                gda_dict_field_set_length           (GdaDictField *field,
                                                             gint length);

`field` : |
`length` : |

### gda_dict_field_get_length ()

    gint                gda_dict_field_get_length           (GdaDictField *field);

Get the length of a field.

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

### gda_dict_field_set_scale ()

    void                gda_dict_field_set_scale            (GdaDictField *field,
                                                             gint length);

`field` : |
`length` : |

### gda_dict_field_get_scale ()

    gint                gda_dict_field_get_scale            (GdaDictField *field);

Get the scale of a field.

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

### gda_dict_field_get_constraints ()

    GSList*             gda_dict_field_get_constraints      (GdaDictField *field);

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

`field` : | a GdaDictField object
Returns : | a new list of GdaDictConstraint objects

### gda_dict_field_set_default_value ()

    void                gda_dict_field_set_default_value    (GdaDictField *field,
                                                             const GValue *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 GdaDictField object
`value` : | a GValue value or NULL

### gda_dict_field_get_default_value ()

    const GValue*       gda_dict_field_get_default_value    (GdaDictField *field);

Get the default value for the field if ne exists

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

### gda_dict_field_is_null_allowed ()

    gboolean            gda_dict_field_is_null_allowed      (GdaDictField *field);

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

`field` : | a GdaDictField object
Returns : |

### gda_dict_field_is_pkey_part ()

    gboolean            gda_dict_field_is_pkey_part         (GdaDictField *field);

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

`field` : | a GdaDictField object
Returns : |

### gda_dict_field_is_pkey_alone ()

    gboolean            gda_dict_field_is_pkey_alone        (GdaDictField *field);

Test if `field` is alone a primary key constraint

`field` : | a GdaDictField object
Returns : |

### gda_dict_field_is_fkey_part ()

    gboolean            gda_dict_field_is_fkey_part         (GdaDictField *field);

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

`field` : | a GdaDictField object
Returns : |

### gda_dict_field_is_fkey_alone ()

    gboolean            gda_dict_field_is_fkey_alone        (GdaDictField *field);

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

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

### gda_dict_field_set_attributes ()

    void                gda_dict_field_set_attributes       (GdaDictField *field,
                                                             GdaDictFieldAttribute attributes);

`field` : |
`attributes` : |

### gda_dict_field_get_attributes ()

    GdaDictFieldAttribute gda_dict_field_get_attributes     (GdaDictField *field);

`field` : |
Returns : |

## Property Details

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

      "db-table"                 GdaDictTable*         : Read / Write

### The `"entry-plugin"` property

      "entry-plugin"             gchar*                : Read / Write

Default value: NULL