GdaDataModel

Name

GdaDataModel -- Basic data model class

Synopsis



struct      GdaDataModelPrivate;
void        gda_data_model_changed          (GdaDataModel *model);
void        gda_data_model_freeze           (GdaDataModel *model);
void        gda_data_model_thaw             (GdaDataModel *model);
gint        gda_data_model_get_n_rows       (GdaDataModel *model);
gint        gda_data_model_get_n_columns    (GdaDataModel *model);
GdaFieldAttributes* gda_data_model_describe_column
                                            (GdaDataModel *model,
                                             gint col);
const gchar* gda_data_model_get_column_title
                                            (GdaDataModel *model,
                                             gint col);
void        gda_data_model_set_column_title (GdaDataModel *model,
                                             gint col,
                                             const gchar *title);
gint        gda_data_model_get_column_position
                                            (GdaDataModel *model,
                                             const gchar *title);
const GdaRow* gda_data_model_get_row        (GdaDataModel *model,
                                             gint row);
const GdaValue* gda_data_model_get_value_at (GdaDataModel *model,
                                             gint col,
                                             gint row);
gboolean    gda_data_model_is_editable      (GdaDataModel *model);
const GdaRow* gda_data_model_append_row     (GdaDataModel *model,
                                             const GList *values);
gboolean    gda_data_model_remove_row       (GdaDataModel *model,
                                             const GdaRow *row);
gboolean    gda_data_model_update_row       (GdaDataModel *model,
                                             const GdaRow *row);
gboolean    (*GdaDataModelForeachFunc)      (GdaDataModel *model,
                                             GdaRow *row,
                                             gpointer user_data);
void        gda_data_model_foreach          (GdaDataModel *model,
                                             GdaDataModelForeachFunc func,
                                             gpointer user_data);
gboolean    gda_data_model_is_editing       (GdaDataModel *model);
gboolean    gda_data_model_begin_edit       (GdaDataModel *model);
gboolean    gda_data_model_cancel_edit      (GdaDataModel *model);
gboolean    gda_data_model_end_edit         (GdaDataModel *model);
gchar*      gda_data_model_to_comma_separated
                                            (GdaDataModel *model);
gchar*      gda_data_model_to_tab_separated (GdaDataModel *model);
gchar*      gda_data_model_to_xml           (GdaDataModel *model,
                                             gboolean standalone);
const gchar* gda_data_model_get_command_text
                                            (GdaDataModel *recset);
void        gda_data_model_set_command_text (GdaDataModel *recset,
                                             const gchar *txt);
GdaCommandType gda_data_model_get_command_type
                                            (GdaDataModel *recset);
void        gda_data_model_set_command_type (GdaDataModel *recset,
                                             GdaCommandType type);

Description

Details

struct GdaDataModelPrivate

struct GdaDataModelPrivate;


gda_data_model_changed ()

void        gda_data_model_changed          (GdaDataModel *model);

Notify listeners of the given data model object of changes in the underlying data. Listeners usually will connect themselves to the "changed" signal in the GdaDataModel class, thus being notified of any new data being appended or removed from the data model.


gda_data_model_freeze ()

void        gda_data_model_freeze           (GdaDataModel *model);

Disable notifications of changes on the given data model. To re-enable notifications again, you should call the gda_data_model_thaw function.


gda_data_model_thaw ()

void        gda_data_model_thaw             (GdaDataModel *model);

Re-enable notifications of changes on the given data model.


gda_data_model_get_n_rows ()

gint        gda_data_model_get_n_rows       (GdaDataModel *model);

Return the number of rows in the given data model.


gda_data_model_get_n_columns ()

gint        gda_data_model_get_n_columns    (GdaDataModel *model);

Return the number of columns in the given data model.


gda_data_model_describe_column ()

GdaFieldAttributes* gda_data_model_describe_column
                                            (GdaDataModel *model,
                                             gint col);

Query the underlying data model implementation for a description of a given column. That description is returned in the form of a GdaFieldAttributes structure, which contains all the information about the given column in the data model.


gda_data_model_get_column_title ()

const gchar* gda_data_model_get_column_title
                                            (GdaDataModel *model,
                                             gint col);

Return the title for the given column in a data model object.


gda_data_model_set_column_title ()

void        gda_data_model_set_column_title (GdaDataModel *model,
                                             gint col,
                                             const gchar *title);


gda_data_model_get_column_position ()

gint        gda_data_model_get_column_position
                                            (GdaDataModel *model,
                                             const gchar *title);

Get the position of a column on the data model, based on the column's title.


gda_data_model_get_row ()

const GdaRow* gda_data_model_get_row        (GdaDataModel *model,
                                             gint row);

Retrieve a given row from a data model.


gda_data_model_get_value_at ()

const GdaValue* gda_data_model_get_value_at (GdaDataModel *model,
                                             gint col,
                                             gint row);

Retrieve the data stored in the given position (identified by the col and row parameters) on a data model.

This is the main function for accessing data in a model.


gda_data_model_is_editable ()

gboolean    gda_data_model_is_editable      (GdaDataModel *model);

Check whether the given data model can be edited or not.


gda_data_model_append_row ()

const GdaRow* gda_data_model_append_row     (GdaDataModel *model,
                                             const GList *values);

Append a row to the given data model.


gda_data_model_remove_row ()

gboolean    gda_data_model_remove_row       (GdaDataModel *model,
                                             const GdaRow *row);

Remove a row from the data model. This results in the underlying database row being removed in the database.


gda_data_model_update_row ()

gboolean    gda_data_model_update_row       (GdaDataModel *model,
                                             const GdaRow *row);

Update a row data model. This results in the underlying database row's values being changed.


GdaDataModelForeachFunc ()

gboolean    (*GdaDataModelForeachFunc)      (GdaDataModel *model,
                                             GdaRow *row,
                                             gpointer user_data);


gda_data_model_foreach ()

void        gda_data_model_foreach          (GdaDataModel *model,
                                             GdaDataModelForeachFunc func,
                                             gpointer user_data);

Call the specified callback function for each row in the data model. This will just traverse all rows, and call the given callback function for each of them.

The callback function must have the following form:

gboolean foreach_func (GdaDataModel *model, GdaRow *row, gpointer user_data)

where "row" would be the row being read, and "user_data" the parameter specified in user_data in the call to gda_data_model_foreach. This callback function can return FALSE to stop the processing. If it


gda_data_model_is_editing ()

gboolean    gda_data_model_is_editing       (GdaDataModel *model);

Check whether this data model is in editing mode or not. Editing mode is set to TRUE when gda_data_model_begin_edit has been called successfully, and is not set back to FALSE until either gda_data_model_cancel_edit or gda_data_model_end_edit have been called.


gda_data_model_begin_edit ()

gboolean    gda_data_model_begin_edit       (GdaDataModel *model);

Start edition of this data model. This function should be the first called when modifying the data model.


gda_data_model_cancel_edit ()

gboolean    gda_data_model_cancel_edit      (GdaDataModel *model);

Cancels edition of this data model. This means that all changes will be discarded, and the old data put back in the model.


gda_data_model_end_edit ()

gboolean    gda_data_model_end_edit         (GdaDataModel *model);

Approves all modifications and send them to the underlying data source/store.


gda_data_model_to_comma_separated ()

gchar*      gda_data_model_to_comma_separated
                                            (GdaDataModel *model);

Convert the given model into a comma-separated series of rows.


gda_data_model_to_tab_separated ()

gchar*      gda_data_model_to_tab_separated (GdaDataModel *model);


gda_data_model_to_xml ()

gchar*      gda_data_model_to_xml           (GdaDataModel *model,
                                             gboolean standalone);


gda_data_model_get_command_text ()

const gchar* gda_data_model_get_command_text
                                            (GdaDataModel *recset);

Get the text of command that generated this data model.


gda_data_model_set_command_text ()

void        gda_data_model_set_command_text (GdaDataModel *recset,
                                             const gchar *txt);


gda_data_model_get_command_type ()

GdaCommandType gda_data_model_get_command_type
                                            (GdaDataModel *recset);

Get the type of command that generated this data model.


gda_data_model_set_command_type ()

void        gda_data_model_set_command_type (GdaDataModel *recset,
                                             GdaCommandType type);