gda-field

## gda-field gda-field — Management of database fields |

## Synopsis

                GdaFieldAttributes;
                GdaField;
    #define     GDA_TYPE_FIELD_ATTRIBUTES
    GType       gda_field_attributes_get_type   (void);
    GdaFieldAttributes* gda_field_attributes_new
                                                (void);
    GdaFieldAttributes* gda_field_attributes_copy
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_free       (GdaFieldAttributes *fa);
    gboolean    gda_field_attributes_equal      (const GdaFieldAttributes *lhs,
                                                 const GdaFieldAttributes *rhs);
    glong       gda_field_attributes_get_defined_size
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_defined_size
                                                (GdaFieldAttributes *fa,
                                                 glong size);
    const gchar* gda_field_attributes_get_name  (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_name   (GdaFieldAttributes *fa,
                                                 const gchar *name);
    const gchar* gda_field_attributes_get_table (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_table  (GdaFieldAttributes *fa,
                                                 const gchar *table);
    const gchar* gda_field_attributes_get_caption
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_caption
                                                (GdaFieldAttributes *fa,
                                                 const gchar *caption);
    glong       gda_field_attributes_get_scale  (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_scale  (GdaFieldAttributes *fa,
                                                 glong scale);
    GdaValueType gda_field_attributes_get_gdatype
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_gdatype
                                                (GdaFieldAttributes *fa,
                                                 GdaValueType type);
    gboolean    gda_field_attributes_get_allow_null
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_allow_null
                                                (GdaFieldAttributes *fa,
                                                 gboolean allow);
    gboolean    gda_field_attributes_get_primary_key
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_primary_key
                                                (GdaFieldAttributes *fa,
                                                 gboolean pk);
    gboolean    gda_field_attributes_get_unique_key
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_unique_key
                                                (GdaFieldAttributes *fa,
                                                 gboolean uk);
    const gchar* gda_field_attributes_get_references
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_references
                                                (GdaFieldAttributes *fa,
                                                 const gchar *ref);
    gboolean    gda_field_attributes_get_auto_increment
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_auto_increment
                                                (GdaFieldAttributes *fa,
                                                 gboolean is_auto);
    gint        gda_field_attributes_get_position
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_position
                                                (GdaFieldAttributes *fa,
                                                 gint position);
    const GdaValue* gda_field_attributes_get_default_value
                                                (GdaFieldAttributes *fa);
    void        gda_field_attributes_set_default_value
                                                (GdaFieldAttributes *fa,
                                                 const GdaValue *default_value);

## Description

## Details

### GdaFieldAttributes

    typedef struct {
    	gint defined_size;
    	gchar *name;
    	gchar *table;
    	gchar *caption;
    	gint scale;
    	GdaValueType gda_type;
    	gboolean allow_null;
    	gboolean primary_key;
    	gboolean unique_key;
    	gchar *references;
    	gboolean auto_increment;
    	glong auto_increment_start;
    	glong auto_increment_step;
    	gint position;
    	GdaValue *default_value;
    } GdaFieldAttributes;

### GdaField

    typedef struct {
    	gint actual_size;
    	GdaValue *value;
    	GdaFieldAttributes *attributes;
    } GdaField;

### GDA_TYPE_FIELD_ATTRIBUTES

    #define GDA_TYPE_FIELD_ATTRIBUTES (gda_field_attributes_get_type ())

### gda_field_attributes_get_type ()

    GType       gda_field_attributes_get_type   (void);

Returns : |

### gda_field_attributes_new ()

    GdaFieldAttributes* gda_field_attributes_new
                                                (void);

Returns : | a newly allocated GdaFieldAttributes object.

### gda_field_attributes_copy ()

    GdaFieldAttributes* gda_field_attributes_copy
                                                (GdaFieldAttributes *fa);

Creates a new GdaFieldAttributes object from an existing one.

`fa` : | attributes to get a copy from.
Returns : | a newly allocated GdaFieldAttributes with a copy of the data in `fa`.

### gda_field_attributes_free ()

    void        gda_field_attributes_free       (GdaFieldAttributes *fa);

Deallocates all memory associated to the given GdaFieldAttributes object.

`fa` : | the resource to free.

### gda_field_attributes_equal ()

    gboolean    gda_field_attributes_equal      (const GdaFieldAttributes *lhs,
                                                 const GdaFieldAttributes *rhs);

Tests whether two field attributes are equal.

`lhs` : | a GdaFieldAttributes
`rhs` : | another GdaFieldAttributes
Returns : | `TRUE` if the field attributes contain the same information.

### gda_field_attributes_get_defined_size ()

    glong       gda_field_attributes_get_defined_size
                                                (GdaFieldAttributes *fa);

`fa` : | a `GdaFieldAttributes`.
Returns : | the defined size of `fa`.

### gda_field_attributes_set_defined_size ()

    void        gda_field_attributes_set_defined_size
                                                (GdaFieldAttributes *fa,
                                                 glong size);

Sets the defined size of a GdaFieldAttributes.

`fa` : | a GdaFieldAttributes.
`size` : | the defined size we want to set.

### gda_field_attributes_get_name ()

    const gchar* gda_field_attributes_get_name  (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | the name of `fa`.

### gda_field_attributes_set_name ()

    void        gda_field_attributes_set_name   (GdaFieldAttributes *fa,
                                                 const gchar *name);

Sets the name of `fa` to `name`.

`fa` : | a GdaFieldAttributes.
`name` : | the new name of `fa`.

### gda_field_attributes_get_table ()

    const gchar* gda_field_attributes_get_table (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | the name of the table to which this field belongs.

### gda_field_attributes_set_table ()

    void        gda_field_attributes_set_table  (GdaFieldAttributes *fa,
                                                 const gchar *table);

Sets the name of the table to which the given field belongs.

`fa` : | a GdaFieldAttributes.
`table` : | table name.

### gda_field_attributes_get_caption ()

    const gchar* gda_field_attributes_get_caption
                                                (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | `fa`'s caption.

### gda_field_attributes_set_caption ()

    void        gda_field_attributes_set_caption
                                                (GdaFieldAttributes *fa,
                                                 const gchar *caption);

Sets `fa`'s `caption`.

`fa` : | a GdaFieldAttributes.
`caption` : | caption.

### gda_field_attributes_get_scale ()

    glong       gda_field_attributes_get_scale  (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | the number of decimals of `fa`.

### gda_field_attributes_set_scale ()

    void        gda_field_attributes_set_scale  (GdaFieldAttributes *fa,
                                                 glong scale);

Sets the scale of `fa` to `scale`.

`fa` : | a GdaFieldAttributes.
`scale` : | number of decimals.

### gda_field_attributes_get_gdatype ()

    GdaValueType gda_field_attributes_get_gdatype
                                                (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | the type of `fa`.

### gda_field_attributes_set_gdatype ()

    void        gda_field_attributes_set_gdatype
                                                (GdaFieldAttributes *fa,
                                                 GdaValueType type);

Sets the type of `fa` to `type`.

`fa` : | a GdaFieldAttributes.
`type` : | the new type of `fa`.

### gda_field_attributes_get_allow_null ()

    gboolean    gda_field_attributes_get_allow_null
                                                (GdaFieldAttributes *fa);

Gets the 'allow null' flag of the given field attributes.

`fa` : | a GdaFieldAttributes.
Returns : | whether the given field allows null values or not (`TRUE` or `FALSE`).

### gda_field_attributes_set_allow_null ()

    void        gda_field_attributes_set_allow_null
                                                (GdaFieldAttributes *fa,
                                                 gboolean allow);

Sets the 'allow null' flag of the given field attributes.

`fa` : | a GdaFieldAttributes.
`allow` : | whether the given field should allows null values or not.

### gda_field_attributes_get_primary_key ()

    gboolean    gda_field_attributes_get_primary_key
                                                (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | whether if the given field is a primary key (`TRUE` or `FALSE`).

### gda_field_attributes_set_primary_key ()

    void        gda_field_attributes_set_primary_key
                                                (GdaFieldAttributes *fa,
                                                 gboolean pk);

Sets the 'primary key' flag of the given field attributes.

`fa` : | a GdaFieldAttributes.
`pk` : | whether if the given field should be a primary key.

### gda_field_attributes_get_unique_key ()

    gboolean    gda_field_attributes_get_unique_key
                                                (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | whether if the given field is an unique key (`TRUE` or `FALSE`).

### gda_field_attributes_set_unique_key ()

    void        gda_field_attributes_set_unique_key
                                                (GdaFieldAttributes *fa,
                                                 gboolean uk);

Sets the 'unique key' flag of the given field attributes.

`fa` : | a GdaFieldAttributes.
`uk` : | whether if the given field should be an unique key.

### gda_field_attributes_get_references ()

    const gchar* gda_field_attributes_get_references
                                                (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | `fa`'s references.

### gda_field_attributes_set_references ()

    void        gda_field_attributes_set_references
                                                (GdaFieldAttributes *fa,
                                                 const gchar *ref);

Sets `fa`'s `references`.

`fa` : | a GdaFieldAttributes.
`ref` : | references.

### gda_field_attributes_get_auto_increment ()

    gboolean    gda_field_attributes_get_auto_increment
                                                (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | whether the given field is an auto incremented one (`TRUE` or `FALSE`).

### gda_field_attributes_set_auto_increment ()

    void        gda_field_attributes_set_auto_increment
                                                (GdaFieldAttributes *fa,
                                                 gboolean is_auto);

Sets the auto increment flag for the given field.

`fa` : | a GdaFieldAttributes.
`is_auto` : | auto increment status.

### gda_field_attributes_get_position ()

    gint        gda_field_attributes_get_position
                                                (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | the position of the field the attributes refer to in the containing data model.

### gda_field_attributes_set_position ()

    void        gda_field_attributes_set_position
                                                (GdaFieldAttributes *fa,
                                                 gint position);

Sets the position of the field the attributes refer to in the containing data model.

`fa` : | a GdaFieldAttributes.
`position` : | the wanted position of the field in the containing data model.

### gda_field_attributes_get_default_value ()

    const GdaValue* gda_field_attributes_get_default_value
                                                (GdaFieldAttributes *fa);

`fa` : | a GdaFieldAttributes.
Returns : | `fa`'s default value, as a GdaValue object.

### gda_field_attributes_set_default_value ()

    void        gda_field_attributes_set_default_value
                                                (GdaFieldAttributes *fa,
                                                 const GdaValue *default_value);

Sets `fa`'s default GdaValue.

`fa` : | a GdaFieldAttributes.
`default_value` : | default GdaValue for the field