Re: [gnome-db] append row to data model.



On Thu, 2006-01-26 at 09:44 +0100, Vivien Malerba wrote:
2006/1/26, Bas Driessen <bas driessen xobas com>:
> 

...
...
...
Here is what I suggest:
* modify the folloging function, which should make the postgres's
recordset work again (I'll commit it to CVS myself).
static gint
gda_data_model_row_append_values (GdaDataModel *model, const GList
*values, GError **error)
{
	GdaRow *row;

	g_return_val_if_fail (GDA_IS_DATA_MODEL_ROW (model), -1);
	g_return_val_if_fail (CLASS (model)->append_values != NULL, -1);

	row = CLASS (model)->append_values (GDA_DATA_MODEL_ROW (model), values, error);
	if (row)
		return gda_row_get_number (row);
	else {
		if (CLASS (model)->append_row) {
			gint retval = -1;

			row = gda_row_new_from_list (model, values);
			if (CLASS (model)->append_row (GDA_DATA_MODEL_ROW (model), row, error))
				retval = gda_row_get_number (row);
			g_object_unref (row);

			return retval;
		}
		else
			return -1;
	}
}

* use the gda_data_model_append_values() function, or write the
gda_data_model_row_append_row() as I suggested above

Tell me if it works OK.

I agree with the concept to address this issue, but I don't believe this code above will work OK. If I append a row with values to the datamodel, it returns the line number of the new row and it exits. At that point I also want to append it to the database. In the code above, you try to add the row to the database if appending to the datamodel fails, but that is the other way around if I read it correctly.  I will do a some testing.

Thanks,
Bas.




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