GdaDictField

## 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_data_type    (GdaDictField *field,
                                                 GdaDictType *type);
    void        gda_dict_field_set_default_value
                                                (GdaDictField *field,
                                                 const GdaValue *value);
    const GdaValue* 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,
                                                 guint attributes);
    guint       gda_dict_field_get_attributes   (GdaDictField *field);

## Object Hierarchy

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

## Implemented Interfaces

GdaDictField implements GdaXmlStorage, GdaEntityField and GdaRenderer.

## Properties

      "db-table"             gpointer              : 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 impact 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_data_type ()

    void        gda_dict_field_set_data_type    (GdaDictField *field,
                                                 GdaDictType *type);

Sets the data type of the field

`field` : | a GdaDictField object
`type` : | a GdaDictType object

### gda_dict_field_set_default_value ()

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

### gda_dict_field_get_default_value ()

    const GdaValue* 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,
                                                 guint attributes);

`field` : |
`attributes` : |

### gda_dict_field_get_attributes ()

    guint       gda_dict_field_get_attributes   (GdaDictField *field);

`field` : |
Returns : |

## Properties

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

      "db-table"             gpointer              : Read / Write