Re: [gnome-db] gda_data_model_import_from_model ()



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi Vivien,

Vivien Malerba wrote:
> 
> 
> What you can do is create a new empty GdaDataModel and fill it with the
> 2 data models you have. To create a new empty data model, use
> gda_data_model_array_new() or gda_data_model_array_new_with_g_types()
> and then
>  
> gda_data_model_import_from_model (new_model, to);
> gda_data_model_import_from_model (new_model, from);
> 
> where to and from are your 2 data models you mentionned. This has the
> drawback of consuming more memory as data is being copied to the new
> data model.


yep, this works good.

> 
> Another solution is to create a new object which implements the
> GdaDataModel interface and, for each virtual method to be implemented,
> calls the same virtual method of the concatenated data models (I suppose
> they have the same number of columns and column types). This is fairly
> simple and the most efficient approach as no data is copied. For an
> example of this kind of approach, look at the gda-data-meta-wrapper.h
> and gda-data-meta-wrapper.c files which implement a GdaDataModel
> interface which transforms some values of another data model.
> 

this kind of solution was more attracting. I've implemented a
GdaDataModelConcat class, on which you can append more models and access
them by row number. Everything was working until I encountered another
problem: the GdaDataModelIter. In my current application setup I'm using
it to browse the model's records and, being the GdaDataModelIter not an
interface, I'm afraid that I cannot maintain the same naming to iter
through the GdaDataModelConcat records.
More: I don't see a method, analyzing gda-data-model-iter.[c|h], to
switch on the fly the underlying model.

I suppose then that I'll switch to the solution 1. In my particular
situation I have more models composed by at most 1 row, so copying them
in a new bigger model shouldn't have a really bad performance.

thanks and regards,
Massimo

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpjt1oACgkQcfVTgMRILk19/ACfc8PzZNeFBY2pVNEPRtHxM2mI
ZQgAniqPUfW/RHQHCgXbBCz+ybz9PjO5
=KM6a
-----END PGP SIGNATURE-----


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