Re: [gnome-db] Multi column indexes.



On Tue, 01 Feb 2005 12:20:57 +0100, Rodrigo Moya <rodrigo gnome-db org> wrote:
> On Tue, 2005-02-01 at 11:39 +0100, Vivien Malerba wrote:
[...]
> 
> > >
> > > Please respond. If you have other/better ideas/suggestions or if you
> > > think some basics are missing, let me know.
> > >
> >
> > I was wondering if we could add a method to the GdaDataModel to allow
> > for efficient retreival of a row given one or more GdaValues using the
> > index structure you just described.
> >
> > Let me explain: I have a GdaDataModel (for example the result of a
> > "SELECT * from table"), and I need to find the row corresponding to a
> > specific value of the primary key of that table. At the moment, I need
> > to parse all the rows of the data model and see if each row is the one
> > I'm looking for.
> >
> > We could have a
> > GdaRow *gda_data_model_locate_row (GdaDataModel *model,
> > GdaDataModelIndex *index, GList *values)
> > which would locate the correct row in @model using @index and for the
> > GdaValues in @values.
> > 
> @values would be all the fields you want to use for the search?

Yes.

> 
> > This method could then be implemented by each data model class for
> > better performances, and there could be a default fallback to the
> > complete data model parsing if that particular method has not been
> > implemented for a data model.
> >
> > What do you think? Do you think the GdaDataModelIndex structure as it
> > is now could be used for that purpose?
> > 
> I think it is a nice idea, and indeed something we need. I don't like
> though, or don't understand very well, the function signature you've
> used. Wouldn't it probably be better to just use something like:
> 
>         gda_data_model_locate_row (model, const char *field | int field,
> GdaValue *value_to_look)

Because I need to be able to find a specific row which has the values
I want for several columns, not just one column.

> 
> also, apart from that, it would be nice to add iterator functions for
> the data model, like:
> 
>         GdaRow *gda_data_model_get_next_row (model, GdaRow *row_to_start_from,
> args_for_search)
>         GdaRow *gda_data_model_get_previous_row (...)
> 
> thus, we can use locate_row and get_next/previous_row to navigate though
> the model easily. When the args_for_search are NULL, get_*_row would
> just return the next/previous row in the model.

Yes, good idea!

Vivien



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