[libgda] mysql: fix loading provider's specs



commit 9efb86c2804aee9d105ad8d632e28b92d9194625
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Thu Jan 17 11:27:25 2019 -0600

    mysql: fix loading provider's specs

 providers/mysql/gda-mysql-provider.c | 36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)
---
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 4032ddbaf..01f6ee6b6 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -811,41 +811,29 @@ gda_mysql_provider_create_operation (GdaServerProvider       *provider,
                                     G_GNUC_UNUSED GdaSet    *options,
                                     GError                 **error)
 {
-        gchar *file;
+        gchar *opname;
         GdaServerOperation *op;
         gchar *str;
-       gchar *dir;
-
-       if (cnc) {
-               g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-               g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, FALSE);
-       }
-
-        file = g_utf8_strdown (gda_server_operation_op_type_to_string (type), -1);
-        str = g_strdup_printf ("mysql_specs_%s", file);
-        g_free (file);
 
-       gchar *tmp;
-       tmp = g_strdup_printf ("%s.xml", str);
-       dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
-        file = gda_server_provider_find_file (provider, dir, tmp);
-       g_free (dir);
-       g_free (tmp);
+  if (cnc) {
+    g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+    g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, FALSE);
+  }
 
-  if (!file)
-    file = g_strdup_printf ("/spec/mysql/%s.raw.xml", str);
+  opname = g_utf8_strdown (gda_server_operation_op_type_to_string (type), -1);
+  str = g_strdup_printf ("/spec/mysql/mysql_specs_%s.raw.xml", opname);
+  g_free (opname);
 
   op = GDA_SERVER_OPERATION (g_object_new (GDA_TYPE_SERVER_OPERATION, 
                                            "op-type", type, 
-                                           "spec-resource", file, 
-                                           "connection",cnc,
-                                           "provider",provider,
+                                           "spec-resource", str,
+                                           "connection", cnc,
+                                           "provider", provider,
                                            NULL));
 
   g_free (str);
-  g_free (file);
 
-        return op;
+  return op;
 }
 
 /*


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