GdaDictField

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

Functions

Properties

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

Types and Values

Object Hierarchy

    GObject
    ╰── GdaObject
        ╰── GdaDictField

Implemented Interfaces

GdaDictField implements GdaXmlStorage, GdaEntityField and GdaRenderer.

Description

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

Functions

gda_dict_field_new ()

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

Creates a new GdaDictField object

Parameters

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);


gda_dict_field_get_length ()

gint
gda_dict_field_get_length (GdaDictField *field);

Get the length of a field.

Parameters

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);


gda_dict_field_get_scale ()

gint
gda_dict_field_get_scale (GdaDictField *field);

Get the scale of a field.

Parameters

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

Parameters

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).

Parameters

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

Parameters

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

Parameters

field

a GdaDictField object

 

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

Parameters

field

a GdaDictField object

 

gda_dict_field_is_pkey_alone ()

gboolean
gda_dict_field_is_pkey_alone (GdaDictField *field);

Test if field is alone a primary key constraint

Parameters

field

a GdaDictField object

 

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

Parameters

field

a GdaDictField object

 

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.

Parameters

field

a GdaDictField object

 

Returns

the new attributes value


gda_dict_field_set_attributes ()

void
gda_dict_field_set_attributes (GdaDictField *field,
                               GdaDictFieldAttribute attributes);


gda_dict_field_get_attributes ()

GdaDictFieldAttribute
gda_dict_field_get_attributes (GdaDictField *field);

Types and Values

GdaDictField

typedef struct _GdaDictField GdaDictField;


enum GdaDictFieldAttribute

Members

FIELD_AUTO_INCREMENT

   

Property Details

The “db-table” property

  “db-table”                 GdaDictTable *

Flags: Read / Write


The “entry-plugin” property

  “entry-plugin”             gchar *

Flags: Read / Write

Default value: NULL