Re: gtk_object_get_data and gtk_object_set_data



> 
> Am Sam, 04 Nov 2000 17:53:45 schrieb(en) Reinhard Müller:
> > Gda_ConnectionPool uses gtk_object_set_data to store the dsn with each
> > provider, and gtk_object_get_data to investigate if a connection that
> > is requested is already there.
> > Actually, only the gda_name is compared.
> > As there is no similar function to gtk_object_???_data in glib (at last
> > I found none), would something hinder us to simple store the gda_name
> > of the connection in a new member of the Gda_Connection structure
> > (of course via two new functions gda_connection_set_gda_name and
> > gda_connection_get_gda_name)?
> 
> Meanwhile I had the new idea to use a GHashTable instead of a GList to
> store the pointers to the Gda_Connection's, and to use the gda_name
> that was used to open the connection as the key of the Hash Table.
> This would also bring advantages in speed.
> 
> What would you think?
> --
it looks perfect to me. The problem with the Gda_ConnectionPool object is that
I wrote it very quickly for the gnomedb-components application, so as Vivien
pointed out some days ago, it is missing many things.

So, do it as you like. A GHashTable seems perfect for the job.

Also, take care of what Vivien said: store a reference count for each
connection, and add a gda_connection_pool_disconnect function, to be called
from clients, so that the connections don't lay around for ever.

cheers






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