Re: [gnome-db] libgda cursor support



On 9/26/07, Murray Cumming <murrayc murrayc com> wrote:
>
> On Wed, 2007-09-26 at 13:39 +0200, Vivien Malerba wrote:
> > On 9/26/07, Murray Cumming <murrayc murrayc com> wrote:
> > >
> > > On Wed, 2007-09-26 at 12:04 +0200, Vivien Malerba wrote:
> > > > On 9/26/07, Murray Cumming <murrayc murrayc com> wrote:
> > > > > On Wed, 2007-09-26 at 10:29 +0200, Vivien Malerba wrote:
> > > > > > You can't use gda_data_model_get_value_at () when you are using a
> > > > > > cursor, that API call is for random access (I should make that clear
> > > > > > in the doc), here is my small correction:
> > > > > >
> > > > > > [...]
> > > > > > GdaDataModelIter *iter = gda_data_model_create_iter(model);
> > > > > >
> > > > > > /* fetch the GdaParameter in iter for the first column */
> > > > > > GdaParameter *param = GDA_PARAMETER (GDA_PARAMETER_LIST
> > > > > > (iter)->parameters->data);
> > > > > >
> > > > > > while(gda_data_model_iter_move_next(iter))
> > > > > >       {
> > > > > >               const int row = gda_data_model_iter_get_row(iter);
> > > > > >               printf("row=%d\n", row);
> > > > > >
> > > > > >               /*const GValue *value = gda_data_model_get_value_at(model, 0, row);*/
> > > > > >               const GValue *value = gda_parameter_get_value (param);
> > > > >
> > > > > That's a really horrible API. How do we get a value for a different
> > > > > column?
> > > >
> > > > The point was just to show how to do it, the correct API to do it is:
> > > > param = gda_parameter_list_find_param (iter, "col_name")
> > >
> > > Thanks. I still think that's quite unpleasant. This idea of getting a
> > > "parameter" for the column is strange.
> > >
> > > I'd prefer something like
> > > GValue* value = gda_data_model_iter_get_value_at(col_number);
> > > and
> > > GValue* value = gda_data_model_iter_get_value_for_field("colname");
> >
> > I know some of the object's names are not obvious, but this can't be
> > changed without changing the API; working on the API will be a job for
> > a future 4.0 release.
>
> Yes, at some point we need to do a review of the whole API and do a 4.0.
>
> Most importantly, we need to clearly show what's internal API and what's
> public API.

Yes, I already have some ideas which I'll post on the gnome-db.org
wiki at some point. I first want the 3.2 version out.

>
> > Anyway, adding such methods is very easy and I can do it if you want.
>
> That would be nice. Thanks. That would help to push that Parameter to
> being "internal API" that I don't have to use.

Ok, I'll do it.



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