Re: [gnome-db] Proveedores GDA para Firebird y PostgreSQL



On 7/16/05, Iago Rubio <iago iagorubio com> wrote:
> On Sat, 2005-07-16 at 14:55 +0200, Vivien Malerba wrote:
> > On 7/15/05, Juan Manuel Mouriz <jmouriz gmail com> wrote:
> > > Hola,
> > >
> > > Quiero consultar las características que soporta un proveedor sin
> > > tener que estar conectado. Para ello llamo al método "supports"
> > > cargando previamente el módulo del proveedor. El problema es que casi
> > > todos los proveedores me permiten pasar NULL el la conexión excepto el
> > > Firebird:
> > >
> > > /* supports handler for the GdaFirebirdProvider class */
> > > static gboolean
> > > gda_firebird_provider_supports (GdaServerProvider *provider,
> > >                                 GdaConnection *cnc,
> > >                                 GdaConnectionFeature feature)
> > > {
> > >         g_return_val_if_fail (GDA_IS_FIREBIRD_PROVIDER (provider), FALSE);
> > > >>>  g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
> > >
> > >         switch (feature) {
> > >                 case GDA_CONNECTION_FEATURE_VIEWS:
> > >                 case GDA_CONNECTION_FEATURE_SQL:
> > >                 case GDA_CONNECTION_FEATURE_TRANSACTIONS:
> > >                 case GDA_CONNECTION_FEATURE_AGGREGATES:
> > >                         return TRUE;
> > >                 case GDA_CONNECTION_FEATURE_TRIGGERS:
> > >                 case GDA_CONNECTION_FEATURE_INDEXES:
> > >                 case GDA_CONNECTION_FEATURE_PROCEDURES:
> > >                 case GDA_CONNECTION_FEATURE_USERS:
> > >                 case GDA_CONNECTION_FEATURE_BLOBS:
> > >                 default:
> > >                         break;
> > >         }
> > >
> > >         return FALSE;
> > > }
> >
> > That is corrected in CVS!
> >
> > >
> > > ¿Existe la posibilidad que esta línea desaparezca en futuras
> > > versiones?, pues realmente "cnc" no se usa aquí. Y en general este
> > > método se accede mediante el API de GDA que ya hace esta comprobación
> > > (gda_connections_supports).
> 
> [Translated]
> 
> "May be possible to drop this line in future versions ? as "cnc" is not
> really used here. Usually this method is accessed through GDA's API,
> where this check is also done (gda_connections_supports)."
> 
> > > Otro problema que veo es que el proveedor de PostgreSQL NO hace esta
> > > verificación:
> 
> "Another problem I see is PostgreeSQL provider NOT making this
> verification."
> 
> > > static gboolean gda_postgres_provider_supports (GdaServerProvider *provider,
> > >                                                 GdaConnection *cnc,
> > >                                                 GdaConnectionFeature feature)
> > > {
> > >         GdaPostgresProvider *pgprv = (GdaPostgresProvider *) provider;
> > >         GdaPostgresConnectionData *priv_data;
> > >
> > >         g_return_val_if_fail (GDA_IS_POSTGRES_PROVIDER (pgprv), FALSE);
> > >
> > >         switch (feature) {
> > >         case GDA_CONNECTION_FEATURE_AGGREGATES :
> > >         case GDA_CONNECTION_FEATURE_INDEXES :
> > >         case GDA_CONNECTION_FEATURE_INHERITANCE :
> > >         case GDA_CONNECTION_FEATURE_PROCEDURES :
> > >         case GDA_CONNECTION_FEATURE_SEQUENCES :
> > >         case GDA_CONNECTION_FEATURE_SQL :
> > >         case GDA_CONNECTION_FEATURE_TRANSACTIONS :
> > >         case GDA_CONNECTION_FEATURE_TRIGGERS :
> > >         case GDA_CONNECTION_FEATURE_USERS :
> > >         case GDA_CONNECTION_FEATURE_VIEWS :
> > >         case GDA_CONNECTION_FEATURE_BLOBS :
> > >                 return TRUE;
> > >         case GDA_CONNECTION_FEATURE_NAMESPACES :
> > >                 priv_data = g_object_get_data (G_OBJECT (cnc),
> > > OBJECT_DATA_POSTGRES_HANDLE);
> > >                 if (priv_data->version_float >= 7.3)
> > >                         return TRUE;
> > >         default :
> > >                 break;
> > >         }
> > >
> > >         return FALSE;
> > > }
> > >
> > > Sin embargo la usa para consultar la característica
> > > GDA_CONNECTION_FEATURE_NAMESPACES.
> 
> "But it uses it to request the setting
> GDA_CONNECTION_FEATURE_NAMESPACES."
> 
> > La pregunta es: ¿Existe la
> > > posibilidad que si en algún momento se agregue este comprobación se
> > > haga sólo justo antes de usarla?, es decir justo antes de la línea
> > > "priv_data = g_object_get_data (G_OBJECT (cnc)".
> 
> [Ouch! that's not easy at all, it's freely translated]
> 
> "The question here is:  If you'll add this check in a near future, Could
> be possible to add it just before to use it ? I mean just before the
> line:
> 'priv_data = g_object_get_data (G_OBJECT (cnc)'."

Yes, great remark, I'll do it.

> 
> > > Por último. Luego de cargar el módulo, llamo al método
> > > "plugin_create_provider" para crear una instancia del proveedor y
> > > poder consultalo. El problema es que luego de hacer esto quiero
> > > descargar el módulo con g_modulo_unload pero el tipo GLib
> > > "GdaXXXProvider" queda registrado, hay alguna forma de
> > > "desregistrarlo"?.
> 
> "And finally: after to load the module, I call the
> 'plugin_create_provider' method, to create a provider's instance to be
> able to make requests to it. Before to do it, I unload the module with
> 'g_module_unload' but GLib's type 'GdaXXXProvider' is still registered.
> Is there any way to unregister it ? "
> 

I don't know, but I think it's possible, have a look at the Glib types
system documentation?

> I hope this cheap translation helps :)

Yes, thanks a lot!

Vivien



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