![]() |
![]() |
![]() |
GNOME Data Access 4 manual | ![]() |
---|---|---|---|---|
Top | Description |
Subclassing GdaDataSelectSubclassing GdaDataSelect — Base class for all the data models returned by DBMS providers when a SELECT statement is executed |
#include <libgda/providers-support/gda-data-select-priv.h> GdaDataSelectClass; void gda_data_select_take_row (GdaDataSelect *model
,GdaRow *row
,gint rownum
); GdaRow * gda_data_select_get_stored_row (GdaDataSelect *model
,gint rownum
); GdaConnection * gda_data_select_get_connection (GdaDataSelect *model
); void gda_data_select_set_columns (GdaDataSelect *model
,GSList *columns
); void gda_column_set_name (GdaColumn *column
,const gchar *name
); void gda_column_set_description (GdaColumn *column
,const gchar *title
); void gda_column_set_dbms_type (GdaColumn *column
,const gchar *dbms_type
); void gda_column_set_g_type (GdaColumn *column
,GType type
); void gda_column_set_allow_null (GdaColumn *column
,gboolean allow
); void gda_column_set_auto_increment (GdaColumn *column
,gboolean is_auto
); void gda_column_set_position (GdaColumn *column
,gint position
); void gda_column_set_default_value (GdaColumn *column
,const GValue *default_value
); gchar * gda_alphanum_to_text (gchar *text
); gchar * gda_text_to_alphanum (const gchar *text
); gboolean gda_data_model_iter_move_next_default (GdaDataModel *model
,GdaDataModelIter *iter
); gboolean gda_data_model_iter_move_prev_default (GdaDataModel *model
,GdaDataModelIter *iter
); void gda_row_invalidate_value (GdaRow *row
,GValue *value
); gboolean gda_row_value_is_valid (GdaRow *row
,GValue *value
);
All database providers should subclass this class when returning a data model after the execution of a SELECT statement. Specifically it has the following features:
See the Virtual methods for recordsets section for more information about how to implement the virtual methods of the subclassed object.
This section documents the methods available for the database provider's implementations.
typedef struct { GObjectClass parent_class; /* GDA_DATA_MODEL_ACCESS_RANDOM */ gint (*fetch_nb_rows) (GdaDataSelect *model); gboolean (*fetch_random) (GdaDataSelect *model, GdaRow **prow, gint rownum, GError **error); gboolean (*store_all) (GdaDataSelect *model, GError **error); /* GDA_STATEMENT_MODEL_CURSOR_* */ gboolean (*fetch_next) (GdaDataSelect *model, GdaRow **prow, gint rownum, GError **error); gboolean (*fetch_prev) (GdaDataSelect *model, GdaRow **prow, gint rownum, GError **error); gboolean (*fetch_at) (GdaDataSelect *model, GdaRow **prow, gint rownum, GError **error); /* Padding for future expansion */ void (*_gda_reserved1) (void); void (*_gda_reserved2) (void); void (*_gda_reserved3) (void); void (*_gda_reserved4) (void); } GdaDataSelectClass;
GObjectClass |
parent object class |
virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_RANDOM | |
virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_RANDOM | |
virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD | |
virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD | |
virtual method which can be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD or GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD | |
void gda_data_select_take_row (GdaDataSelect *model
,GdaRow *row
,gint rownum
);
Stores row
into model
, externally advertized at row number rownum
(if no row has been removed).
The reference to row
is stolen.
|
a GdaDataSelect data model |
|
a GdaRow row. [transfer full] |
|
"external" advertized row number |
GdaRow * gda_data_select_get_stored_row (GdaDataSelect *model
,gint rownum
);
Get the GdaRow object stored within model
at row rownum
(without taking care of removed rows)
|
a GdaDataSelect data model |
|
"external" advertized row number |
Returns : |
the requested GdaRow, or NULL if not found. [transfer none]
|
GdaConnection * gda_data_select_get_connection (GdaDataSelect *model
);
Get a pointer to the GdaConnection object which was used when model
was created
(and which may be used internally by model
).
|
a GdaDataSelect data model |
Returns : |
a pointer to the GdaConnection, or NULL . [transfer none]
|
void gda_data_select_set_columns (GdaDataSelect *model
,GSList *columns
);
Makes columns
the list of columns for model
. Both the list and each GdaColumn object in the
list are 'stolen' by model
(ie. when this function returns the caller should not use anymore
the list or each column object in it). This method should not be used directly, it is used by
database provider's implementations.
|
a GdaDataSelect data model |
|
a lis of GdaColumn objects. [transfer full] |
Since 4.2.1
void gda_column_set_name (GdaColumn *column
,const gchar *name
);
Sets the name of column
to name
.
|
a GdaColumn. |
|
the new name of column .
|
void gda_column_set_description (GdaColumn *column
,const gchar *title
);
Sets the column's description
|
a GdaColumn. |
|
title name. |
void gda_column_set_dbms_type (GdaColumn *column
,const gchar *dbms_type
);
Defines column
's database type
|
a GdaColumn |
|
a string |
void gda_column_set_g_type (GdaColumn *column
,GType type
);
Sets the type of column
to type
.
|
a GdaColumn. |
|
the new type of column .
|
void gda_column_set_allow_null (GdaColumn *column
,gboolean allow
);
Sets the 'allow null' flag of the given column.
|
a GdaColumn. |
|
whether the given column should allows null values or not. |
void gda_column_set_auto_increment (GdaColumn *column
,gboolean is_auto
);
Sets the auto increment flag for the given column.
|
a GdaColumn. |
|
auto increment status. |
void gda_column_set_position (GdaColumn *column
,gint position
);
Sets the position of the column refer to in the containing data model.
|
a GdaColumn. |
|
the wanted position of the column in the containing data model. |
void gda_column_set_default_value (GdaColumn *column
,const GValue *default_value
);
Sets column
's default GValue.
gchar * gda_alphanum_to_text (gchar *text
);
Does the opposite of gda_text_to_alphanum()
, in the same string
|
a string |
Returns : |
text if conversion succeeded or NULL if an error occurred
|
gchar * gda_text_to_alphanum (const gchar *text
);
The "encoding" consists in replacing non alphanumeric character with the string "__gdaXX" where XX is the hex. representation of the non alphanumeric char.
|
the text to convert |
Returns : |
a new string |
gboolean gda_data_model_iter_move_next_default (GdaDataModel *model
,GdaDataModelIter *iter
);
|
|
|
|
Returns : |
gboolean gda_data_model_iter_move_prev_default (GdaDataModel *model
,GdaDataModelIter *iter
);
|
|
|
|
Returns : |
void gda_row_invalidate_value (GdaRow *row
,GValue *value
);
Marks value
as being invalid. This method is mainly used by database
providers' implementations to report any error while reading a value from the database.
|
a GdaRow |
|
a GValue belonging to row (obtained with gda_row_get_value() ).
|
gboolean gda_row_value_is_valid (GdaRow *row
,GValue *value
);
Tells if value
has been marked as being invalid by gda_row_invalidate_value()
.
This method is mainly used by database
providers' implementations to report any error while reading a value from the database.
|
a GdaRow. |
|
a GValue belonging to row (obtained with gda_row_get_value() ).
|
Returns : |
TRUE if value is valid
|