libgda r3273 - in trunk: . doc/C doc/C/tmpl libgda providers/bdb providers/jdbc providers/mdb providers/mysql providers/postgres providers/skel-implementation/capi providers/skel-implementation/models providers/sqlite



Author: vivien
Date: Tue Dec 30 20:06:55 2008
New Revision: 3273
URL: http://svn.gnome.org/viewvc/libgda?rev=3273&view=rev

Log:
2008-12-30  Vivien Malerba <malerba gnome-db org>

	* libgda/gda-util.[ch]: added gda_utility_data_model_find_column_description(),
	thanks to Carlos Savoretti
	* libgda/gda-config.c:
	  - avoid memory leaks with provider's DSN spec and AUTH spec strings
	  - close all GModules after having go tthe list of providers)
	* providers/*/libmain.c: don't leak memory when module is closed
	* providers/jdbc/libmain.c: make sure the GModule is made resident because
	the Java runtime is not completely unloaded (don't know how to do it)
	* libgda/gda-connection.[ch]:
	  - cleaned unused GDA_CONNECTION_*_ERROR codes
	  - improved documentation, see bug #565019
	* doc/C: doc. improvements


Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/doc/C/libgda-4.0-sections.txt
   trunk/doc/C/prov-writing.xml
   trunk/doc/C/tmpl/gda-connection.sgml
   trunk/doc/C/tmpl/gda-server-provider.sgml
   trunk/libgda/gda-config.c
   trunk/libgda/gda-connection.c
   trunk/libgda/gda-connection.h
   trunk/libgda/gda-util.c
   trunk/libgda/gda-util.h
   trunk/providers/bdb/libmain.c
   trunk/providers/jdbc/libmain.c
   trunk/providers/mdb/libmain.c
   trunk/providers/mysql/libmain.c
   trunk/providers/postgres/libmain.c
   trunk/providers/skel-implementation/capi/libmain.c
   trunk/providers/skel-implementation/models/libmain.c
   trunk/providers/sqlite/libmain.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Dec 30 20:06:55 2008
@@ -139,7 +139,7 @@
 dnl linklibext is the shared link library extension, which varies by platform
 
 EXPORT_SYM_REGEX='-export-symbols-regex "^(gda_|fnYM49765777344607__gda).*"'
-EXPORT_PROV_SYM_REGEX='-export-symbols-regex "^(plugin_|Java_).*"'
+EXPORT_PROV_SYM_REGEX='-export-symbols-regex "^(plugin_|Java_|g_module).*"'
 AC_MSG_CHECKING([for platform])
 platform_win32=no
 platform_carbon=no

Modified: trunk/doc/C/libgda-4.0-sections.txt
==============================================================================
--- trunk/doc/C/libgda-4.0-sections.txt	(original)
+++ trunk/doc/C/libgda-4.0-sections.txt	Tue Dec 30 20:06:55 2008
@@ -102,6 +102,8 @@
 <TITLE>GdaConnection</TITLE>
 GdaConnection
 GdaConnectionOptions
+GdaConnectionError
+GDA_CONNECTION_ERROR
 gda_connection_open_from_dsn
 gda_connection_open_from_string
 gda_connection_open
@@ -469,6 +471,7 @@
 GdaServerProvider
 GdaServerProviderClass
 GdaServerProviderError
+GDA_SERVER_PROVIDER_ERROR
 GdaServerProviderMeta
 GdaServerProviderAsyncCallback
 GdaServerProviderExecCallback

Modified: trunk/doc/C/prov-writing.xml
==============================================================================
--- trunk/doc/C/prov-writing.xml	(original)
+++ trunk/doc/C/prov-writing.xml	Tue Dec 30 20:06:55 2008
@@ -728,7 +728,14 @@
     </para>
     <sect2>
       <title>plugin_init()</title>
-      <para>This function initializes the plugin; it has a single argument which is the path where the provider is.</para>
+      <para>This function initializes the plugin; it has a single argument which is the path where the provider is.
+	As the module can be unloaded, any static data allocated here must be freed when the module is unloaded,
+	in a <link linkend="GModuleUnload">g_module_unload()</link> function. If the module must not be
+	unloaded, it must be made resident using <link linkend="g-module-make-resident">g_module_make_resident()</link>, 
+	in a <link linkend="GModuleCheckInit">g_module_check_init()</link> function</para>
+      <para>Note that after a <link linkend="GdaServerProvider">GdaServerProvider</link> object has been 
+	created (ie after plugin_create_provider() has
+	been called once), the module will not be unloaded anymore.</para>
     </sect2>
     <sect2>
       <title>plugin_get_name()</title>

Modified: trunk/doc/C/tmpl/gda-connection.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-connection.sgml	(original)
+++ trunk/doc/C/tmpl/gda-connection.sgml	Tue Dec 30 20:06:55 2008
@@ -115,6 +115,26 @@
 @GDA_CONNECTION_OPTIONS_NONE: 
 @GDA_CONNECTION_OPTIONS_READ_ONLY: 
 
+<!-- ##### ENUM GdaConnectionError ##### -->
+<para>
+
+</para>
+
+ GDA_CONNECTION_DSN_NOT_FOUND_ERROR: 
+ GDA_CONNECTION_PROVIDER_NOT_FOUND_ERROR: 
+ GDA_CONNECTION_PROVIDER_ERROR: 
+ GDA_CONNECTION_NO_CNC_SPEC_ERROR: 
+ GDA_CONNECTION_NO_PROVIDER_SPEC_ERROR: 
+ GDA_CONNECTION_OPEN_ERROR: 
+ GDA_CONNECTION_STATEMENT_TYPE_ERROR: 
+
+<!-- ##### MACRO GDA_CONNECTION_ERROR ##### -->
+<para>
+
+</para>
+
+
+
 <!-- ##### FUNCTION gda_connection_open_from_dsn ##### -->
 <para>
 

Modified: trunk/doc/C/tmpl/gda-server-provider.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-server-provider.sgml	(original)
+++ trunk/doc/C/tmpl/gda-server-provider.sgml	Tue Dec 30 20:06:55 2008
@@ -89,6 +89,13 @@
 @GDA_SERVER_PROVIDER_SERVER_VERSION_ERROR: 
 @GDA_SERVER_PROVIDER_DATA_ERROR: 
 
+<!-- ##### MACRO GDA_SERVER_PROVIDER_ERROR ##### -->
+<para>
+
+</para>
+
+
+
 <!-- ##### STRUCT GdaServerProviderMeta ##### -->
 <para>
 These methods must be implemented by providers to update a connection's associated metadata (in a 

Modified: trunk/libgda/gda-config.c
==============================================================================
--- trunk/libgda/gda-config.c	(original)
+++ trunk/libgda/gda-config.c	Tue Dec 30 20:06:55 2008
@@ -1092,7 +1092,23 @@
 	}
 	
 	/* need to actually create the provider object */
-	g_assert (ip->handle);
+	if (!ip->handle) {
+		GdaProviderInfo *info = (GdaProviderInfo*) ip;
+		ip->handle = g_module_open (info->location, G_MODULE_BIND_LAZY);
+		if (!ip->handle) {
+			g_set_error (error, GDA_CONFIG_ERROR, GDA_CONFIG_PROVIDER_CREATION_ERROR,
+				     _("Can't load provider: %s"), g_module_error ());
+			return NULL;
+		}
+
+		void (*plugin_init) (const gchar *);
+		if (g_module_symbol (ip->handle, "plugin_init", (gpointer *) &plugin_init)) {
+			gchar *dirname = g_path_get_dirname (info->location);
+			plugin_init (dirname);
+			g_free (dirname);
+		}
+	}
+
 	g_module_symbol (ip->handle, "plugin_create_provider", (gpointer) &plugin_create_provider);
 	if (plugin_create_provider)
 		ip->instance = plugin_create_provider ();
@@ -1241,15 +1257,15 @@
 }
 
 static InternalProvider *
-create_internal_provider (GModule *handle, const gchar *path,
+create_internal_provider (const gchar *path,
 			  const gchar *prov_name, const gchar *prov_descr,
-			  const gchar *dsn_spec, const gchar *auth_spec)
+			  gchar *dsn_spec, gchar *auth_spec)
 {
 	InternalProvider *ip;
 	GdaProviderInfo *info;
 
 	ip = g_new0 (InternalProvider, 1);
-	ip->handle = handle;
+	ip->handle = NULL;
 	info = (GdaProviderInfo*) ip;
 	info->location = g_strdup (path);
 
@@ -1272,8 +1288,10 @@
 			/* there may be traces of the provider installed but some parts are missing,
 			   forget about that provider... */
 			internal_provider_free (ip);
+			g_free (dsn_spec);
 			return NULL;
 		}
+		g_free (dsn_spec);
 	}
 	else
 		g_warning ("Provider '%s' does not provide a DSN spec", info->id);
@@ -1296,8 +1314,10 @@
 			/* there may be traces of the provider installed but some parts are missing,
 			   forget about that provider... */
 			internal_provider_free (ip);
+			g_free (auth_spec);
 			return NULL;
 		}
+		g_free (auth_spec);
 	}
 	else {
 		/* default to username/password */
@@ -1402,11 +1422,10 @@
 		if (plugin_get_sub_names) {
 			const gchar **subnames = plugin_get_sub_names ();
 			const gchar **ptr;
-			gboolean module_used = FALSE;
 			for (ptr = subnames; ptr && *ptr; ptr++) {
 				InternalProvider *ip;
 								
-				ip = create_internal_provider (handle, path, *ptr,
+				ip = create_internal_provider (path, *ptr,
 							       plugin_get_sub_description ? 
 							       plugin_get_sub_description (*ptr) : NULL,
 							       plugin_get_sub_dsn_spec ? 
@@ -1416,18 +1435,15 @@
 				if (ip) {
 					unique_instance->priv->prov_list =
 						g_slist_prepend (unique_instance->priv->prov_list, ip);
-					module_used = TRUE;
 #ifdef GDA_DEBUG_NO
 					g_print ("Loaded '%s' sub-provider\n", ((GdaProviderInfo*) ip)->id);
 #endif
 				}
 			}
-			if (!module_used)
-				g_module_close (handle);
 		}
 		else {
 			InternalProvider *ip;
-			ip = create_internal_provider (handle, path,
+			ip = create_internal_provider (path,
 						       plugin_get_name ? plugin_get_name () : name,
 						       plugin_get_description ? plugin_get_description () : NULL,
 						       plugin_get_dsn_spec ? plugin_get_dsn_spec () : NULL,
@@ -1439,9 +1455,8 @@
 				g_print ("Loaded '%s' provider\n", ((GdaProviderInfo*) ip)->id);
 #endif
 			}
-			else
-				g_module_close (handle);
 		}
+		g_module_close (handle);
 	}
 
 	/* free memory */

Modified: trunk/libgda/gda-connection.c
==============================================================================
--- trunk/libgda/gda-connection.c	(original)
+++ trunk/libgda/gda-connection.c	Tue Dec 30 20:06:55 2008
@@ -794,7 +794,7 @@
 		dsn_info = gda_config_get_dsn_info (cnc->priv->dsn);
 		if (!dsn_info) {
 			gda_log_error (_("Data source %s not found in configuration"), cnc->priv->dsn);
-			g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_NONEXIST_DSN_ERROR,
+			g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_DSN_NOT_FOUND_ERROR,
 				     _("Data source %s not found in configuration"), cnc->priv->dsn);
 			gda_connection_unlock ((GdaLockable*) cnc);
 			return FALSE;
@@ -1536,6 +1536,8 @@
  *   <listitem><para>one with the '+1' ID which will contain 'joe' (note that its "name" property should be "name")</para></listitem>
  * </itemizedlist>
  *
+ * This method may fail with a %GDA_SERVER_PROVIDER_ERROR domain error (see the #GdaServerProviderError error codes).
+ *
  * Note1: If @stmt is a SELECT statement which has some parameters and  if @params is %NULL, then the statement can't
  * be executed and this method will return %NULL.
  *

Modified: trunk/libgda/gda-connection.h
==============================================================================
--- trunk/libgda/gda-connection.h	(original)
+++ trunk/libgda/gda-connection.h	Tue Dec 30 20:06:55 2008
@@ -50,15 +50,12 @@
 	GDA_CONNECTION_DSN_NOT_FOUND_ERROR,
 	GDA_CONNECTION_PROVIDER_NOT_FOUND_ERROR,
 	GDA_CONNECTION_PROVIDER_ERROR,
-        GDA_CONNECTION_CONN_OPEN_ERROR,
-        GDA_CONNECTION_DO_QUERY_ERROR,
-	GDA_CONNECTION_NONEXIST_DSN_ERROR,
 	GDA_CONNECTION_NO_CNC_SPEC_ERROR,
 	GDA_CONNECTION_NO_PROVIDER_SPEC_ERROR,
 	GDA_CONNECTION_OPEN_ERROR,
-	GDA_CONNECTION_EXECUTE_COMMAND_ERROR,
 	GDA_CONNECTION_STATEMENT_TYPE_ERROR
 } GdaConnectionError;
+#define GDA_CONNECTION_NONEXIST_DSN_ERROR GDA_CONNECTION_DSN_NOT_FOUND_ERROR
 
 struct _GdaConnection {
 	GObject               object;

Modified: trunk/libgda/gda-util.c
==============================================================================
--- trunk/libgda/gda-util.c	(original)
+++ trunk/libgda/gda-util.c	Tue Dec 30 20:06:55 2008
@@ -385,6 +385,61 @@
 	return retval;
 }
 
+
+/**
+ * gda_utility_data_model_find_column_description
+ * @model: a #GdaDataSelect data model
+ * @field_name: field name
+ *
+ * Finds the description of a field into Metadata from a #GdaDataModel.
+ *
+ * Returns: The field's description, or NULL if description is not set
+ */
+const gchar *
+gda_utility_data_model_find_column_description (GdaDataSelect *model, const gchar *field_name)
+{
+	g_return_val_if_fail (GDA_IS_DATA_SELECT (model), NULL);
+	g_return_val_if_fail (field_name, NULL);
+
+	GdaConnection *connection = gda_data_select_get_connection ((GdaDataSelect *) model);
+
+	GdaStatement *statement;
+	g_object_get (G_OBJECT (model), "select-stmt", &statement, NULL);
+	if (!statement)
+		return NULL;
+
+	GdaSqlStatement *sql_statement;
+	g_object_get (G_OBJECT (statement), "structure", &sql_statement, NULL);
+	g_object_unref (statement);
+
+	if (!gda_sql_statement_check_validity (sql_statement, connection, NULL)) {
+		gda_sql_statement_free (sql_statement);
+		return NULL;
+	}
+
+	GSList *fields;
+	for (fields = ((GdaSqlStatementSelect *) sql_statement->contents)->expr_list;
+	     fields;
+	     fields = fields->next) {
+
+		GdaSqlSelectField *select_field = fields->data;
+		if (select_field->validity_meta_table_column) {
+			GdaMetaTableColumn *meta_table_column = select_field->validity_meta_table_column;
+
+			if (! strcmp (meta_table_column->column_name, field_name)) {
+				const GValue *gvalue = gda_meta_table_column_get_attribute
+					(meta_table_column, GDA_ATTRIBUTE_DESCRIPTION);
+
+				gda_sql_statement_free (sql_statement);
+				return g_value_get_string (gvalue);
+			}
+		}
+	}
+
+	gda_sql_statement_free (sql_statement);
+	return NULL;
+}
+
 /**
  * gda_utility_holder_load_attributes
  * @holder:

Modified: trunk/libgda/gda-util.h
==============================================================================
--- trunk/libgda/gda-util.h	(original)
+++ trunk/libgda/gda-util.h	Tue Dec 30 20:06:55 2008
@@ -29,6 +29,7 @@
 #include "gda-row.h"
 #include "gda-connection.h"
 #include <sql-parser/gda-sql-statement.h>
+#include <libgda/gda-data-select.h>
 
 G_BEGIN_DECLS
 
@@ -54,6 +55,7 @@
 gboolean     gda_utility_data_model_dump_data_to_xml (GdaDataModel *model, xmlNodePtr parent, 
 					      const gint *cols, gint nb_cols, const gint *rows, gint nb_rows,
 					      gboolean use_col_ids);
+const gchar *gda_utility_data_model_find_column_description (GdaDataSelect *model, const gchar *field_name);
 gboolean     gda_utility_holder_load_attributes (GdaHolder *holder, xmlNodePtr node, GSList *sources, GError **error);
 
 /* 

Modified: trunk/providers/bdb/libmain.c
==============================================================================
--- trunk/providers/bdb/libmain.c	(original)
+++ trunk/providers/bdb/libmain.c	Tue Dec 30 20:06:55 2008
@@ -21,6 +21,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
 #include "gda-bdb.h"
@@ -32,6 +33,26 @@
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (GModule *module)
+{
+	/*g_module_make_resident (module);*/
+	return NULL;
+}
+
+void
+g_module_unload (GModule *module)
+{
+	g_free (module_path);
+	module_path = NULL;
+}
+
+/*
+ * Normal plugin functions 
+ */
 void
 plugin_init (const gchar *real_path)
 {

Modified: trunk/providers/jdbc/libmain.c
==============================================================================
--- trunk/providers/jdbc/libmain.c	(original)
+++ trunk/providers/jdbc/libmain.c	Tue Dec 30 20:06:55 2008
@@ -39,6 +39,7 @@
 #define EXPORT
 #endif
 
+static GModule *jvm_handle = NULL;
 
 /* JVM's symbols */
 static GStaticMutex vm_create = G_STATIC_MUTEX_INIT;
@@ -70,11 +71,47 @@
 static gchar **sub_names = NULL;
 static gint    sub_nb; /* size of sub_names */
 
+/* Functions executed when calling g_module_open() and g_module_close()
+ *
+ * The GModule is made resident here because I haven't found a way to completely unload the JVM, maybe
+ *    http://forums.sun.com/thread.jspa?threadID=5321076
+ * would be the solution...
+ */
+EXPORT const gchar *
+g_module_check_init (GModule *module)
+{
+	g_module_make_resident (module);
+	return NULL;
+}
+
+EXPORT void
+g_module_unload (GModule *module)
+{
+	g_assert_not_reached ();
+
+	g_free (module_path);
+	module_path = NULL;
+
+	/*
+	__CreateJavaVM = NULL;
+	jni_wrapper_destroy_vm (_jdbc_provider_java_vm);
+	_jdbc_provider_java_vm = NULL;
+	if (jvm_handle) {
+		g_module_close (jvm_handle);
+		jvm_handle = NULL;
+	}
+	*/
+}
+
+/*
+ * Normal plugin functions 
+ */
 EXPORT void
 plugin_init (const gchar *real_path)
 {
         if (real_path)
                 module_path = g_strdup (real_path);
+	load_jvm ();
 }
 
 EXPORT const gchar **
@@ -102,6 +139,8 @@
 			   error && error->message ? error->message : _("No detail"));
 		if (error)
 			g_error_free (error);
+
+		(*_jdbc_provider_java_vm)->DetachCurrentThread (_jdbc_provider_java_vm);
 		return NULL;		
 	}
 	if (!gda_value_is_null (lvalue)) {
@@ -124,10 +163,12 @@
 			g_hash_table_insert (jdbc_drivers_hash, (gchar*) dr->name, dr);
 		}
 		
+		(*_jdbc_provider_java_vm)->DetachCurrentThread (_jdbc_provider_java_vm);
 		return (const gchar **) sub_names;
 	}
 	else {
 		g_free (lvalue);
+		(*_jdbc_provider_java_vm)->DetachCurrentThread (_jdbc_provider_java_vm);
 		return NULL;
 	}
 }
@@ -314,7 +355,11 @@
 	GDir *dir;
 	GError *err = NULL;
 	const gchar *name;
-	gboolean jvm_found = FALSE;
+
+	if (jvm_handle) {
+		g_module_close (jvm_handle);
+		jvm_handle = NULL;
+	}
 
 	/* read the plugin directory */
 #ifdef GDA_DEBUG_NO
@@ -333,34 +378,34 @@
 		if (!g_strrstr (name, "jvm"))
 			continue;
 
-		GModule *handle;
 		gchar *path;
 
 		path = g_build_path (G_DIR_SEPARATOR_S, dir_name, name, NULL);
-		handle = g_module_open (path, G_MODULE_BIND_LAZY);
+		jvm_handle = g_module_open (path, G_MODULE_BIND_LAZY);
 		g_free (path);
-		if (!handle) {
+		if (!jvm_handle) {
 			/*g_warning (_("Error: %s"), g_module_error ());*/
 			continue;
 		}
 
-		if (g_module_symbol (handle, "JNI_CreateJavaVM", (gpointer *) &__CreateJavaVM)) {
+		if (g_module_symbol (jvm_handle, "JNI_CreateJavaVM", (gpointer *) &__CreateJavaVM)) {
 			/* JVM found */
 #ifdef GDA_DEBUG_NO
 			path = g_build_path (G_DIR_SEPARATOR_S, dir_name, name, NULL);
 			g_print ("JVM found as: '%s'\n", path);
 			g_free (path);
 #endif
-			jvm_found = TRUE;
 			break;
 		}
-		else
-			g_module_close (handle);
+		else {
+			g_module_close (jvm_handle);
+			jvm_handle = NULL;
+		}
 
 	}
 	/* free memory */
 	g_dir_close (dir);
-	return jvm_found;
+	return jvm_handle ? TRUE : FALSE;
 }
 
 static const gchar *

Modified: trunk/providers/mdb/libmain.c
==============================================================================
--- trunk/providers/mdb/libmain.c	(original)
+++ trunk/providers/mdb/libmain.c	Tue Dec 30 20:06:55 2008
@@ -21,6 +21,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
 #include "gda-mdb.h"
@@ -33,6 +34,26 @@
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (GModule *module)
+{
+        /*g_module_make_resident (module);*/
+        return NULL;
+}
+
+void
+g_module_unload (GModule *module)
+{
+        g_free (module_path);
+        module_path = NULL;
+}
+
+/*
+ * Normal plugin functions 
+ */
 void
 plugin_init (const gchar *real_path)
 {

Modified: trunk/providers/mysql/libmain.c
==============================================================================
--- trunk/providers/mysql/libmain.c	(original)
+++ trunk/providers/mysql/libmain.c	Tue Dec 30 20:06:55 2008
@@ -20,6 +20,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
 #include "gda-mysql.h"
@@ -31,6 +32,26 @@
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (GModule *module)
+{
+        /*g_module_make_resident (module);*/
+        return NULL;
+}
+
+void
+g_module_unload (GModule *module)
+{
+        g_free (module_path);
+        module_path = NULL;
+}
+
+/*
+ * Normal plugin functions 
+ */
 void
 plugin_init (const gchar *real_path)
 {

Modified: trunk/providers/postgres/libmain.c
==============================================================================
--- trunk/providers/postgres/libmain.c	(original)
+++ trunk/providers/postgres/libmain.c	Tue Dec 30 20:06:55 2008
@@ -20,6 +20,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
 #include "gda-postgres.h"
@@ -31,6 +32,26 @@
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (GModule *module)
+{
+        /*g_module_make_resident (module);*/
+        return NULL;
+}
+
+void
+g_module_unload (GModule *module)
+{
+        g_free (module_path);
+        module_path = NULL;
+}
+
+/*
+ * Normal plugin functions 
+ */
 void
 plugin_init (const gchar *real_path)
 {

Modified: trunk/providers/skel-implementation/capi/libmain.c
==============================================================================
--- trunk/providers/skel-implementation/capi/libmain.c	(original)
+++ trunk/providers/skel-implementation/capi/libmain.c	Tue Dec 30 20:06:55 2008
@@ -20,6 +20,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
 #include "gda-capi.h"
@@ -31,6 +32,26 @@
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (GModule *module)
+{
+        /*g_module_make_resident (module);*/
+        return NULL;
+}
+
+void
+g_module_unload (GModule *module)
+{
+        g_free (module_path);
+        module_path = NULL;
+}
+
+/*
+ * Normal plugin functions 
+ */
 void
 plugin_init (const gchar *real_path)
 {

Modified: trunk/providers/skel-implementation/models/libmain.c
==============================================================================
--- trunk/providers/skel-implementation/models/libmain.c	(original)
+++ trunk/providers/skel-implementation/models/libmain.c	Tue Dec 30 20:06:55 2008
@@ -20,6 +20,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-config.h>
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
@@ -32,6 +33,26 @@
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (GModule *module)
+{
+        /*g_module_make_resident (module);*/
+        return NULL;
+}
+
+void
+g_module_unload (GModule *module)
+{
+        g_free (module_path);
+        module_path = NULL;
+}
+
+/*
+ * Normal plugin functions 
+ */
 void
 plugin_init (const gchar *real_path)
 {

Modified: trunk/providers/sqlite/libmain.c
==============================================================================
--- trunk/providers/sqlite/libmain.c	(original)
+++ trunk/providers/sqlite/libmain.c	Tue Dec 30 20:06:55 2008
@@ -22,6 +22,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-config.h>
 #include "gda-sqlite-provider.h"
 #include <libgda/gda-server-provider-extra.h>
@@ -33,6 +34,26 @@
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (GModule *module)
+{
+        /*g_module_make_resident (module);*/
+        return NULL;
+}
+
+void
+g_module_unload (GModule *module)
+{
+        g_free (module_path);
+        module_path = NULL;
+}
+
+/*
+ * Normal plugin functions 
+ */
 void
 plugin_init (const gchar *real_path)
 {



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