Top | ![]() |
![]() |
![]() |
![]() |
GQuark | gda_db_column_error_quark () |
GdaDbColumn * | gda_db_column_new () |
GdaDbColumn * | gda_db_column_new_from_meta () |
gboolean | gda_db_column_get_autoinc () |
void | gda_db_column_set_autoinc () |
const gchar * | gda_db_column_get_check () |
void | gda_db_column_set_check () |
const gchar * | gda_db_column_get_comment () |
void | gda_db_column_set_comment () |
GType | gda_db_column_get_gtype () |
const gchar * | gda_db_column_get_ctype () |
void | gda_db_column_set_type () |
const gchar * | gda_db_column_get_default () |
void | gda_db_column_set_default () |
const gchar * | gda_db_column_get_name () |
void | gda_db_column_set_name () |
gboolean | gda_db_column_get_nnul () |
void | gda_db_column_set_nnul () |
gboolean | gda_db_column_get_pkey () |
void | gda_db_column_set_pkey () |
guint | gda_db_column_get_scale () |
void | gda_db_column_set_scale () |
guint | gda_db_column_get_size () |
void | gda_db_column_set_size () |
gboolean | gda_db_column_get_unique () |
void | gda_db_column_set_unique () |
gboolean | gda_db_column_prepare_add () |
gboolean | gda_db_column_prepare_create () |
gboolean | autoinc | Read / Write |
char * | check | Read / Write |
char * | comment | Read / Write |
char * | default | Read / Write |
char * | name | Read / Write |
gboolean | nnul | Read / Write |
gboolean | pkey | Read / Write |
guint | scale | Read / Write |
guint | size | Read / Write |
GdaDbTable * | table | Read / Write |
gboolean | unique | Read / Write |
GdaDbColumn | |
enum | GdaDbColumnError |
#define | GDA_TYPE_DB_COLUMN |
#define | GDA_DB_COLUMN_ERROR |
This object represents a column of a table or a view. The column can be constracted manually using API or generated from xml file together with other databse objects. See GdaDbCatalog. GdaDbColumn implements GdaDbBuildable interface for parsing xml file. This is a typical example how the GdaDbColumn API can be used.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
GdaDbTable *tproject = gda_db_table_new (); gda_db_base_set_name (GDA_DB_BASE (tproject), "Project"); GdaDbColumn *pid = gda_db_column_new (); gda_db_column_set_name (pid, "id"); gda_db_column_set_type (pid, G_TYPE_INT); gda_db_column_set_nnul (pid, TRUE); gda_db_column_set_autoinc (pid, TRUE); gda_db_column_set_unique (pid, TRUE); gda_db_column_set_pkey (pid, TRUE); gda_db_table_append_column (tproject, pid); g_object_unref (pid); |
GdaDbColumn *
gda_db_column_new_from_meta (GdaMetaTableColumn *column
);
Create new GdaDbColumn instance from the corresponding GdaMetaTableColumn
object. If NULL
is passed this function works exactly as
gda_db_column_new()
.
gboolean
gda_db_column_get_autoinc (GdaDbColumn *self
);
Get value for autoinc key
Since: 6.0
Stability Level: Stable
void gda_db_column_set_autoinc (GdaDbColumn *self
,gboolean autoinc
);
Set value for auto-incremented key.
Since: 6.0
Stability Level: Stable
const gchar *
gda_db_column_get_check (GdaDbColumn *self
);
Returns value of the check field.
Since: 6.0
Stability Level: Stable
void gda_db_column_set_check (GdaDbColumn *self
,const gchar *value
);
Sets check string to the column.
Since: 6.0
Stability Level: Stable
const gchar *
gda_db_column_get_comment (GdaDbColumn *self
);
Get value for column comment.
Since: 6.0
Stability Level: Stable
void gda_db_column_set_comment (GdaDbColumn *self
,const gchar *comnt
);
Set value for column comment.
Since: 6.0
Stability Level: Stable
GType
gda_db_column_get_gtype (GdaDbColumn *self
);
Return of column type as GType
Since: 6.0
Stability Level: Stable
const gchar *
gda_db_column_get_ctype (GdaDbColumn *self
);
Returns column type as a string derivied from GType
Since: 6.0
Stability Level: Stable
void gda_db_column_set_type (GdaDbColumn *self
,GType type
);
Set type of the column as a GType. For numeric type, GDA_TYPE_NUMERIC should be used. Other
types, e.g. G_TYPE_FLOAT
or G_TYPE_DOUBLE
can also be used but precision and scale should not be
set. In this case appropriate types for DB implementation will be used, e.g. float4.
Since: 6.0
Stability Level: Stable
const gchar *
gda_db_column_get_default (GdaDbColumn *self
);
Returns default value for the column. Can be NULL
if the default value hasn't been set.
Since: 6.0
Stability Level: Stable
void gda_db_column_set_default (GdaDbColumn *self
,const gchar *value
);
Since: 6.0
Stability Level: Stable
const gchar *
gda_db_column_get_name (GdaDbColumn *self
);
Returns name of the column
Since: 6.0
Stability Level: Stable
void gda_db_column_set_name (GdaDbColumn *self
,const gchar *name
);
Set column name.
Since: 6.0
Stability Level: Stable
gboolean
gda_db_column_get_nnul (GdaDbColumn *self
);
Specify if the column's value can be NULL.
Since: 6.0
Stability Level: Stable
void gda_db_column_set_nnul (GdaDbColumn *self
,gboolean nnul
);
self |
a GdaDbColumn object |
|
nnul |
value to set for nnul
If |
Since: 6.0
Stability Level: Stable
gboolean
gda_db_column_get_pkey (GdaDbColumn *self
);
Returns a primary key flag
Since: 6.0
Stability Level: Stable
void gda_db_column_set_pkey (GdaDbColumn *self
,gboolean pkey
);
If pkey
is TRUE
, the given column will be marked with PRIMERY KEY flag
Since: 6.0
Stability Level: Stable
guint
gda_db_column_get_scale (GdaDbColumn *self
);
Scale is used for float number representation to specify a number of decimal digits. This value is ignore for column types except float or double.
Since: 6.0
Stability Level: Stable
void gda_db_column_set_scale (GdaDbColumn *self
,guint scale
);
Scale is used for float number representation to specify a number of decimal digits. This value is ignore for column types except float or double.
Since: 6.0
Stability Level: Stable
guint
gda_db_column_get_size (GdaDbColumn *self
);
Since: 6.0
Stability Level: Stable
void gda_db_column_set_size (GdaDbColumn *self
,guint size
);
Set value for column size. This is relevant only for string column type.
Since: 6.0
Stability Level: Stable
gboolean
gda_db_column_get_unique (GdaDbColumn *self
);
Get value for unique key
Since: 6.0
Stability Level: Stable
void gda_db_column_set_unique (GdaDbColumn *self
,gboolean unique
);
Set value for unique key.
Since: 6.0
Stability Level: Stable
gboolean gda_db_column_prepare_add (GdaDbColumn *self
,GdaServerOperation *op
,GError **error
);
Populate op
with information stored in self
. This method is used to
prepare op
for GDA_SERVER_OPERATION_ADD_COLUMN
operation.
self |
a GdaDbColumn instance |
|
op |
GdaServerOperation to add information |
|
error |
error storage container |
Since: 6.0
Stability Level: Stable
gboolean gda_db_column_prepare_create (GdaDbColumn *self
,GdaServerOperation *op
,guint order
,GError **error
);
This method populate op
with information stored in self
.
self |
a GdaDbColumn instance |
|
op |
a GdaServerOperation instance to update for TABLE_CREATE operation |
|
order |
Order number for the column |
|
error |
a GError container |
Since: 6.0
Stability Level: Stable
“autoinc”
property “autoinc” gboolean
Can value be autoincremented.
Owner: GdaDbColumn
Flags: Read / Write
Default value: FALSE
“check”
property “check” char *
Column check string.
Owner: GdaDbColumn
Flags: Read / Write
Default value: NULL
“comment”
property “comment” char *
Column comment.
Owner: GdaDbColumn
Flags: Read / Write
Default value: NULL
“default”
property “default” char *
Default value.
Owner: GdaDbColumn
Flags: Read / Write
Default value: NULL
“name”
property “name” char *
Column name.
Owner: GdaDbColumn
Flags: Read / Write
Default value: NULL
“nnul”
property “nnul” gboolean
Can value be NULL.
Owner: GdaDbColumn
Flags: Read / Write
Default value: TRUE
“pkey”
property “pkey” gboolean
Is is primery key.
Owner: GdaDbColumn
Flags: Read / Write
Default value: FALSE
“scale”
property “scale” guint
Number of decimal for numeric type.
Owner: GdaDbColumn
Flags: Read / Write
Allowed values: <= 64
Default value: 2
“size”
property “size” guint
Column size.
Owner: GdaDbColumn
Flags: Read / Write
Allowed values: <= 9999
Default value: 80