Re: Gee Collection for Data Bases



On Fri, 2011-12-09 at 15:45 -0600, Daniel Espinosa wrote:
> Gee have interfaces for Collections, most of them based on the most commons.
> 
> But if I have a Data Base, with million of registers and make use of
> "drivers" like GDA to get access to it. How can Gee help on easy
> access it?
> 
> A data base, as you know, is a Collection of Collections of registers,
> each one with a number of fields. Database engines uses SQL to build
> consults and add information with powerful options; include data
> integrity checks and relations. All these is wrapped by GDA for
> different SQL dialects from different databases engines.
> 
> Once I've gotten a Data Collection from the database, running a SQL to
> get values from one or different tables. What Gee's Data Model could
> be useful?
> 
> How to create powerful filters that use fields and check for filtering criteria?
> 

Do you mean ones which would compile into SQL or the post-processing?

Unfortunately as Vala does not have LINQ the compile into SQL is not
possible.

However I think that the standard way of iteration combined with some
kind of ORM can be useful, especially with the cursors (if algorithm
receives Iterable it may not care about underlying structure). 
 
I guess you could implement the filter function for data sets with large
columns (which you don' want to transfer for filtered out columns) as:

  filter(pred):
     while(cursor.next()):
         record := new Record.lazy(cursor)
         if (pref(record)): // FETCH RELATIVE 0 for used fields
             record.fetch_rest() // get rest of data
             yield record

(pred can different things then WHERE so it can still be useful even if
it is less efficient then database. Also I used fetch of single row
while in practice whole block probably should be fetch at once)

As you probably guessed the answer is to same extend "I don't know". I
guess for this usecase async iterators would be better and maybe
built-in LINQ.

However the reverse may not necessary be false - it should be possible
to same extend build a libgee libgda driver adopting the libgee model to
libgda. While it may not suit all use-cases of libgee it may provide a
simple interface to interact with libgee in LINQ-like fashion.

I am sorry that I cannot give more specific answer,
Best regards



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