[libgda] Misc JDBC provider corrections



commit 125e580af160c726b45eb718c10c0c10809f2141
Author: Vivien Malerba <malerba gnome-db org>
Date:   Mon Dec 14 20:43:34 2009 +0100

    Misc JDBC provider corrections

 providers/jdbc/gda-jdbc-meta.c           |    4 ++--
 providers/jdbc/gda-list-jdbc-providers.c |    1 -
 providers/jdbc/libmain.c                 |   23 ++++++++++++++++++-----
 3 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/providers/jdbc/gda-jdbc-meta.c b/providers/jdbc/gda-jdbc-meta.c
index 7afd081..d55ee5c 100644
--- a/providers/jdbc/gda-jdbc-meta.c
+++ b/providers/jdbc/gda-jdbc-meta.c
@@ -731,8 +731,8 @@ _gda_jdbc_meta_routine_par (GdaServerProvider *prov, GdaConnection *cnc,
 }
 
 gboolean
-_gda_mysql_meta__indexes_tab (GdaServerProvider *prov, GdaConnection *cnc, 
-			      GdaMetaStore *store, GdaMetaContext *context, GError **error)
+_gda_jdbc_meta__indexes_tab (GdaServerProvider *prov, GdaConnection *cnc, 
+			     GdaMetaStore *store, GdaMetaContext *context, GError **error)
 {
 	TO_IMPLEMENT;
 	return TRUE;
diff --git a/providers/jdbc/gda-list-jdbc-providers.c b/providers/jdbc/gda-list-jdbc-providers.c
index 54660b0..aa56d37 100644
--- a/providers/jdbc/gda-list-jdbc-providers.c
+++ b/providers/jdbc/gda-list-jdbc-providers.c
@@ -12,7 +12,6 @@ main (int argc, char **argv)
 	gboolean some_found = FALSE;
 
 	/* set up test environment */
-	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ();
 
 	providers = gda_config_list_providers ();
diff --git a/providers/jdbc/libmain.c b/providers/jdbc/libmain.c
index 46ecdda..b1dc099 100644
--- a/providers/jdbc/libmain.c
+++ b/providers/jdbc/libmain.c
@@ -132,7 +132,16 @@ plugin_get_sub_names (void)
 		return NULL;
 	}
 
-	cls = jni_wrapper_class_get (env, "GdaJProvider", NULL);
+	cls = jni_wrapper_class_get (env, "GdaJProvider", &error);
+	if (!cls) {
+		g_warning (_("Can't get list of installed JDBC drivers: %s"),
+			   error && error->message ? error->message : _("No detail"));
+		if (error)
+			g_error_free (error);
+
+		(*_jdbc_provider_java_vm)->DetachCurrentThread (_jdbc_provider_java_vm);
+		return NULL;		
+	}
 	lvalue = jni_wrapper_method_call (env, GdaJProvider__getDrivers, NULL, NULL, NULL, &error);
 	if (!lvalue) {
 		g_warning (_("Can't get list of installed JDBC drivers: %s"),
@@ -336,13 +345,17 @@ load_jvm ()
 		GError *error = NULL;
 		path = g_build_filename (module_path, "gdaprovider-4.0.jar", NULL);
 		jni_wrapper_create_vm (&_jdbc_provider_java_vm, __CreateJavaVM, module_path, path, &error);
-		if (!_jdbc_provider_java_vm)
-			g_error (_("Can't create JAVA virtual machine: %s"),
-				 error && error->message ? error->message : _("No detail"));	
+		if (!_jdbc_provider_java_vm) {
+			if (g_getenv ("GDA_SHOW_PROVIDER_LOADING_ERROR"))
+				g_warning (_("Can't create JAVA virtual machine: %s"),
+					   error && error->message ? error->message : _("No detail"));
+			jvm_found = FALSE;
+		}
 	}
 	else {
 		__CreateJavaVM = NULL;
-		g_warning (_("Could not the JVM runtime (libjvm.so), JDBC provider is unavailable."));
+		if (g_getenv ("GDA_SHOW_PROVIDER_LOADING_ERROR"))
+			g_warning (_("Could not the JVM runtime (libjvm.so), JDBC provider is unavailable."));
 	}
 
 	g_static_mutex_unlock (&vm_create);



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