GdaDataModelHash

GdaDataModelHash — An implementation of GdaDataModel based on a hash table

Synopsis

                    GdaDataModelHash;
                    GdaDataModelHashClass;
                    GdaDataModelHashPrivate;
GdaDataModel*       gda_data_model_hash_new             (gint cols);
void                gda_data_model_hash_insert_row      (GdaDataModelHash *model,
                                                         gint rownum,
                                                         GdaRow *row);
void                gda_data_model_hash_set_n_columns   (GdaDataModelHash *model,
                                                         gint cols);
void                gda_data_model_hash_clear           (GdaDataModelHash *model);

Object Hierarchy

  GObject
   +----GdaObject
         +----GdaDataModelRow
               +----GdaDataModelHash

Implemented Interfaces

GdaDataModelHash implements GdaDataModel.

Properties

  "n-columns"                guint                 : Read / Write

Description

Unlike GdaDataModelArray, this data model implementation stores the GdaRow in a hash table. So it only retrieves from the database backend exactly the requested rows (while in GdaDataModelArray you have to retrieve all the rows until the one requested).

Details

GdaDataModelHash

typedef struct _GdaDataModelHash GdaDataModelHash;


GdaDataModelHashClass

typedef struct {
	GdaDataModelRowClass parent_class;
} GdaDataModelHashClass;


GdaDataModelHashPrivate

typedef struct _GdaDataModelHashPrivate GdaDataModelHashPrivate;


gda_data_model_hash_new ()

GdaDataModel*       gda_data_model_hash_new             (gint cols);

cols :

number of columns for rows in this data model.

Returns :

a pointer to the newly created GdaDataModel.

gda_data_model_hash_insert_row ()

void                gda_data_model_hash_insert_row      (GdaDataModelHash *model,
                                                         gint rownum,
                                                         GdaRow *row);

Inserts a row in the model.

model :

the GdaDataModelHash which is gonna hold the row.

rownum :

the number of the row.

row :

the row to insert. The model is responsible for freeing it with g_object_unref().

gda_data_model_hash_set_n_columns ()

void                gda_data_model_hash_set_n_columns   (GdaDataModelHash *model,
                                                         gint cols);

Sets the number of columns for rows inserted in this model. cols must be greater than or equal to 0.

Also clears model's contents.

This function calls gda_data_model_hash_clear to free the existing rows if any.

model :

the GdaDataModelHash.

cols :

the number of columns for rows inserted in model.

gda_data_model_hash_clear ()

void                gda_data_model_hash_clear           (GdaDataModelHash *model);

Frees all the rows inserted in model.

model :

the model to clear.

Property Details

The "n-columns" property

  "n-columns"                guint                 : Read / Write

The number of columns in the model.

Default value: 0