DataModelHash

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

Constructors

this
this(GdaDataModelHash* gdaDataModelHash)

Sets our main struct and passes it to the parent class

this
this(int cols)

Members

Functions

clear
void clear()

Frees all the rows inserted in model.

getDataModelHashStruct
GdaDataModelHash* getDataModelHashStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

insertRow
void insertRow(int rownum, Row row)

Inserts a row in the model.

setNColumns
void setNColumns(int cols)

Sets the number of columns for rows inserted in this model. cols must be greater than or equal to 0. This function calls gda_data_model_hash_clear to free the existing rows if any.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

getRow
Row getRow(DataModel model, int row)

Retrieves a row from the underlying hash table.

getValueAt
Value getValueAt(DataModel model, int col, int row)

Retrieves the value at a specified column and row.

Variables

gdaDataModelHash
GdaDataModelHash* gdaDataModelHash;

the main Gtk struct

Inherited Members

From DataModel

gdaDataModel
GdaDataModel* gdaDataModel;

the main Gtk struct

getDataModelStruct
GdaDataModel* getDataModelStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
changed
void changed()

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

rowInserted
void rowInserted(int row)

Emits the 'row_inserted' and 'changed' signals on model.

rowUpdated
void rowUpdated(int row)

Emits the 'row_updated' and 'changed' signals on model.

rowRemoved
void rowRemoved(int row)

Emits the 'row_removed' and 'changed' signal on model.

columnInserted
void columnInserted(int col)

Emits the 'column_inserted' and 'changed' signals on model.

columnUpdated
void columnUpdated(int col)

Emits the 'column_updated' and 'changed' signals on model.

columnRemoved
void columnRemoved(int col)

Emits the 'column_removed' and 'changed' signal on model.

freeze
void freeze()

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

thaw
void thaw()

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

getNRows
int getNRows()
getNColumns
int getNColumns()
describeColumn
FieldAttributes describeColumn(int col)

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

getColumnTitle
string getColumnTitle(int col)
setColumnTitle
void setColumnTitle(int col, string title)

Sets the title of the given col in model.

getColumnPosition
int getColumnPosition(string title)

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

getRow
Row getRow(int row)

Retrieves a given row from a data model.

getValueAt
Value getValueAt(int col, int row)

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

isUpdatable
int isUpdatable()

Checks whether the given data model can be updated or not.

appendRow
Row appendRow(ListG values)

Appends a row to the given data model.

removeRow
int removeRow(Row row)

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

updateRow
int updateRow(Row row)

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

appendColumn
int appendColumn(FieldAttributes attrs)

Appends a column to the given data model. If successful, the position of the new column in the data model is set on col, and you can grab it using gda_field_attributes_get_position.

updateColumn
int updateColumn(int col, FieldAttributes attrs)

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

removeColumn
int removeColumn(int col)

Removes a column from the data model. This means that all values attached to this column in the data model will be destroyed in the underlying database.

foreac
void foreac(GdaDataModelForeachFunc func, void* userData)

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

hasChanged
int hasChanged()

Checks whether this data model is in updating mode or not. Updating mode is set to TRUE when gda_data_model_begin_update has been called successfully, and is not set back to FALSE until either gda_data_model_cancel_update or gda_data_model_end_update have been called.

beginUpdate
int beginUpdate()

Starts update of this data model. This function should be the first called when modifying the data model.

cancelUpdate
int cancelUpdate()

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

endUpdate
int endUpdate()

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

toCommaSeparated
string toCommaSeparated()

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

toTabSeparated
string toTabSeparated()

Converts the given model into a tab-separated series of rows.

toXml
string toXml(int standalone)

Converts the given model into a XML representation.

toXmlNode
xmlNodePtr toXmlNode(string name)

Converts a GdaDataModel into a xmlNodePtr (as used in libxml).

addDataFromXmlNode
int addDataFromXmlNode(xmlNodePtr node)

Adds the data from a XML node to the given data model.

getCommandText
string getCommandText()

Gets the text of command that generated this data model.

setCommandText
void setCommandText(string txt)

Sets the command text of the given model.

getCommandType
GdaCommandType getCommandType()

Gets the type of command that generated this data model.

setCommandType
void setCommandType(GdaCommandType type)

Sets the type of command that generated this data model.

Meta