Re: [gnome-db] turning postgres recordset into a GdaDataModelArray derived object
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: Gonzalo Paniagua Javier <gonzalo gnome-db org>
- Cc: Gnome-db list <gnome-db-list gnome org>
- Subject: Re: [gnome-db] turning postgres recordset into a GdaDataModelArray derived object
- Date: 10 May 2002 03:40:31 +0200
On Fri, 2002-05-10 at 02:57, Gonzalo Paniagua Javier wrote:
> Here it is. Please help me! I keep getting NULL values even
> just before calling append_row in get_value_at
>
> --
> Gonzalo Paniagua Javier <gonzalo gnome-db org>
> http://www.gnome-db.org/~gonzalo/
>
just for the record, we found the cause while talking on IRC:
> +
> GdaDataModel *
> gda_postgres_recordset_new (GdaConnection *cnc, PGresult *pg_res)
> {
> - GdaDataModel *model;
> - GdaDataModelClass *klass;
> - GdaPostgresRecordsetPrivate *priv_data;
> + GdaPostgresRecordset *model;
> GdaPostgresConnectionData *cnc_priv_data;
>
> g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
> @@ -212,28 +317,16 @@
>
> cnc_priv_data = g_object_get_data (G_OBJECT (cnc), OBJECT_DATA_POSTGRES_HANDLE);
>
> - priv_data = g_new (GdaPostgresRecordsetPrivate, 1);
> - priv_data->pg_res = pg_res;
> - priv_data->gda_conn = cnc;
> - priv_data->ntypes = cnc_priv_data->ntypes;
> - priv_data->type_data = cnc_priv_data->type_data;
> - priv_data->h_table = cnc_priv_data->h_table;
> -
> - model = g_object_new (GDA_TYPE_DATA_MODEL, NULL);
> - klass = GDA_DATA_MODEL_CLASS (G_OBJECT_GET_CLASS (model));
> -
> - klass->changed = NULL;
> - klass->begin_edit = NULL;
> - klass->cancel_edit = NULL;
> - klass->end_edit = NULL;
> - klass->get_n_rows = get_n_rows_func;
> - klass->get_n_columns = get_n_columns_func;
> - klass->describe_column = describe_func;
> - klass->get_value_at = get_value_at_func;
> -
> - g_object_set_data_full (G_OBJECT (model), OBJECT_DATA_RECSET_HANDLE,
> - priv_data, (GDestroyNotify) free_postgres_res);
> + g_print ("Creo un recordset\n");
> + model = g_object_new (GDA_TYPE_POSTGRES_RECORDSET, NULL);
> + model->priv->pg_res = pg_res;
> + model->priv->cnc = cnc;
> + model->priv->ntypes = cnc_priv_data->ntypes;
> + model->priv->type_data = cnc_priv_data->type_data;
> + model->priv->h_table = cnc_priv_data->h_table;
> + gda_data_model_array_set_n_columns (GDA_DATA_MODEL_ARRAY (model),
> + PQntuples (pg_res));
>
here, it's setting the number of columns to the number of rows.
cheers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]