Re: [gnome-db] libgda cursor support
- From: Murray Cumming <murrayc murrayc com>
- To: Vivien Malerba <vmalerba gmail com>
- Cc: gnome-db-list <gnome-db-list gnome org>
- Subject: Re: [gnome-db] libgda cursor support
- Date: Wed, 26 Sep 2007 12:12:32 +0200
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");
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]