[gnome-db] patch: hash-append-row (2).



Hello,

Please ignore previous message/patch from a couple of hours ago.
Attached the correct one. I got "bitten" again by the fact that the
hash-table implementation only inserts rows requested and not all of
them.

Bas.

--- ChangeLog.orig	2005-01-07 13:09:36.690258624 +1000
+++ ChangeLog	2005-01-07 13:12:16.001830922 +1000
@@ -1,3 +1,8 @@
+2005-01-07  Bas Driessen <bas driessen xobas com>
+
+	* libgda/gda-data-model-hash.c (gda_data_model_hash_append_row):
+	set row number of appended row.
+
 2004-12-29  Aaron Gaudio <prothonotar tarnation dyndns org>
 
 	* libgda.spec.in: fixed includedir.
--- libgda/gda-data-model-hash.c.orig	2005-01-07 13:02:40.743055318 +1000
+++ libgda/gda-data-model-hash.c	2005-01-07 14:56:37.877845051 +1000
@@ -78,7 +78,7 @@
 gda_data_model_hash_append_row (GdaDataModel *model, const GList *values)
 {
 	GdaRow *row;
-	gint cols;
+	gint cols, rownum;
 
 	g_return_val_if_fail (GDA_IS_DATA_MODEL_HASH (model), NULL);
 	g_return_val_if_fail (values != NULL, NULL);
@@ -89,12 +89,17 @@
 
 	/* create the GdaRow to add */
 	row = gda_row_new_from_list (model, values);
+
+	/* get the new row number */
+	rownum = gda_data_model_get_n_rows (model);
+
 	if (row) {
 		gda_data_model_hash_insert_row (
 			GDA_DATA_MODEL_HASH (model),
-			g_hash_table_size (GDA_DATA_MODEL_HASH (model)->priv->rows),
+			rownum,
 			row);
-		gda_data_model_row_inserted (model, g_hash_table_size (GDA_DATA_MODEL_HASH (model)->priv->rows) - 1);
+		gda_row_set_number (row, rownum);
+		gda_data_model_row_inserted (model, rownum);
 		gda_data_model_changed (model);
 	}
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]