[libgda] Enabled server operations for the MySQL provider



commit 1db8e4e7dd23c742ceb89c0c8c3692ae7fdf0754
Author: Vivien Malerba <malerba gnome-db org>
Date:   Thu Apr 23 20:55:02 2009 +0200

    Enabled server operations for the MySQL provider
    
    	* libgda/gda-config.c: only display a warning if loading a
    	* provider fails if the GDA_SHOW_PROVIDER_LOADING_ERROR environment variable is set
    	* providers/mysql/gda-mysql-provider.c: enable the
    	* GDA_SERVER_OPERATION_CREATE_DB,
    	GDA_SERVER_OPERATION_DROP_DB, GDA_SERVER_OPERATION_DROP_TABLE, GDA_SERVER_OPERATION_RENAME_TABLE,
    	GDA_SERVER_OPERATION_ADD_COLUMN, GDA_SERVER_OPERATION_DROP_COLUMN,
    	GDA_SERVER_OPERATION_CREATE_INDEX, GDA_SERVER_OPERATION_DROP_INDEX,
    	GDA_SERVER_OPERATION_CREATE_VIEW andGDA_SERVER_OPERATION_DROP_VIEW operations
    	* doc/C: doc. update
---
 ChangeLog                            |   11 +++++++++++
 doc/C/libgda-4.0-docs.sgml           |    5 +++++
 libgda/gda-config.c                  |    3 ++-
 providers/mysql/gda-mysql-provider.c |   31 ++++++++++++++++++++++---------
 4 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1fda8b4..d5887a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2009-04-23  Vivien Malerba <malerba gnome-db org>
 
+	* libgda/gda-config.c: only display a warning if loading a provider fails if the
+	GDA_SHOW_PROVIDER_LOADING_ERROR environment variable is set
+	* providers/mysql/gda-mysql-provider.c: enable the GDA_SERVER_OPERATION_CREATE_DB,
+	GDA_SERVER_OPERATION_DROP_DB, GDA_SERVER_OPERATION_DROP_TABLE, GDA_SERVER_OPERATION_RENAME_TABLE,
+	GDA_SERVER_OPERATION_ADD_COLUMN, GDA_SERVER_OPERATION_DROP_COLUMN,
+	GDA_SERVER_OPERATION_CREATE_INDEX, GDA_SERVER_OPERATION_DROP_INDEX,
+	GDA_SERVER_OPERATION_CREATE_VIEW and GDA_SERVER_OPERATION_DROP_VIEW operations
+	* doc/C: doc. update
+
+2009-04-23  Vivien Malerba <malerba gnome-db org>
+
 	* configure.in:
 	* providers/oracle: improved Oracle provider
 
diff --git a/doc/C/libgda-4.0-docs.sgml b/doc/C/libgda-4.0-docs.sgml
index 36c2777..46085c7 100644
--- a/doc/C/libgda-4.0-docs.sgml
+++ b/doc/C/libgda-4.0-docs.sgml
@@ -472,6 +472,11 @@
 		&LIBGDA; threads' support).</para>
 	    </listitem>
 	    <listitem>
+              <para>GDA_SHOW_PROVIDER_LOADING_ERROR: if set, then in case a provider fails to be loaded (usually because
+		it requires a library which can't be found) &LIBGDA; will display a warning message. This variable
+		is usefull to debug the absence of a provider at runtime</para>
+	    </listitem>
+	    <listitem>
               <para>GDA_DATA_MODEL_DUMP_TITLE: if set, then <link linkend="gda-data-model-dump">gda_data_model_dump()</link>
 	      will also output the name of the data model as its first line</para>
 	    </listitem>
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index f22c104..8fd85f4 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -1493,7 +1493,8 @@ load_providers_from_dir (const gchar *dirname, gboolean recurs)
 				     name, NULL);
 		handle = g_module_open (path, G_MODULE_BIND_LAZY);
 		if (!handle) {
-			g_warning (_("Error: %s"), g_module_error ());
+			if (g_getenv ("GDA_SHOW_PROVIDER_LOADING_ERROR"))
+				g_warning (_("Error loading provider '%s': %s"), path, g_module_error ());
 			g_free (path);
 			continue;
 		}
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 2b53089..f31ebc4 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -704,20 +704,16 @@ gda_mysql_provider_supports_operation (GdaServerProvider       *provider,
         switch (type) {
         case GDA_SERVER_OPERATION_CREATE_DB:
         case GDA_SERVER_OPERATION_DROP_DB:
-		return FALSE;
-
         case GDA_SERVER_OPERATION_CREATE_TABLE:
-		return TRUE;
         case GDA_SERVER_OPERATION_DROP_TABLE:
         case GDA_SERVER_OPERATION_RENAME_TABLE:
-
         case GDA_SERVER_OPERATION_ADD_COLUMN:
-
+	case GDA_SERVER_OPERATION_DROP_COLUMN:
         case GDA_SERVER_OPERATION_CREATE_INDEX:
         case GDA_SERVER_OPERATION_DROP_INDEX:
-
         case GDA_SERVER_OPERATION_CREATE_VIEW:
         case GDA_SERVER_OPERATION_DROP_VIEW:
+		return TRUE;
         default:
                 return FALSE;
         }
@@ -810,21 +806,38 @@ gda_mysql_provider_render_operation (GdaServerProvider   *provider,
 	/* actual rendering */
         switch (gda_server_operation_get_op_type (op)) {
         case GDA_SERVER_OPERATION_CREATE_DB:
+		sql = gda_mysql_render_CREATE_DB (provider, cnc, op, error);
+		break;
         case GDA_SERVER_OPERATION_DROP_DB:
-		sql = NULL;
+		sql = gda_mysql_render_DROP_DB (provider, cnc, op, error);
                 break;
         case GDA_SERVER_OPERATION_CREATE_TABLE:
                 sql = gda_mysql_render_CREATE_TABLE (provider, cnc, op, error);
                 break;
         case GDA_SERVER_OPERATION_DROP_TABLE:
+		sql = gda_mysql_render_DROP_TABLE (provider, cnc, op, error);
+		break;
         case GDA_SERVER_OPERATION_RENAME_TABLE:
+		sql = gda_mysql_render_RENAME_TABLE (provider, cnc, op, error);
+		break;
         case GDA_SERVER_OPERATION_ADD_COLUMN:
+		sql = gda_mysql_render_ADD_COLUMN (provider, cnc, op, error);
+		break;
+	case GDA_SERVER_OPERATION_DROP_COLUMN:
+		sql = gda_mysql_render_DROP_COLUMN (provider, cnc, op, error);
+		break;
         case GDA_SERVER_OPERATION_CREATE_INDEX:
+		sql = gda_mysql_render_CREATE_INDEX (provider, cnc, op, error);
+		break;
         case GDA_SERVER_OPERATION_DROP_INDEX:
+		sql = gda_mysql_render_DROP_INDEX (provider, cnc, op, error);
+		break;
         case GDA_SERVER_OPERATION_CREATE_VIEW:
+		sql = gda_mysql_render_CREATE_VIEW (provider, cnc, op, error);
+		break;
         case GDA_SERVER_OPERATION_DROP_VIEW:
-                sql = NULL;
-                break;
+		sql = gda_mysql_render_DROP_VIEW (provider, cnc, op, error);
+		break;
         default:
                 g_assert_not_reached ();
         }



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