[libgda] sqlite-provider: removed custom embedding files



commit 50fa195aa7296bb61c24fe0cf60a954bd6c9ba89
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Jun 21 17:47:19 2018 -0500

    sqlite-provider: removed custom embedding files

 libgda/sqlite/Makefile.am           |  8 +-------
 libgda/sqlite/gda-sqlite-provider.c | 16 +++++++++-------
 2 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/libgda/sqlite/Makefile.am b/libgda/sqlite/Makefile.am
index d0e9a7183..cfc7c3c15 100644
--- a/libgda/sqlite/Makefile.am
+++ b/libgda/sqlite/Makefile.am
@@ -30,12 +30,6 @@ mkkeywordhash$(EXEEXT_FOR_BUILD): mkkeywordhash.c
 keywords_hash.code: mkkeywordhash$(EXEEXT_FOR_BUILD) $(top_srcdir)/libgda/sqlite/keywords.list
        ./mkkeywordhash$(EXEEXT_FOR_BUILD) $(top_srcdir)/libgda/sqlite/keywords.list > keywords_hash.code
 
-gen_emb_string$(EXEEXT_FOR_BUILD): gen_emb_string.c
-       $(CC_FOR_BUILD) -o gen_emb_string$(EXEEXT_FOR_BUILD) $<
-
-xml_embedded.h: gen_emb_string$(EXEEXT_FOR_BUILD) $(top_srcdir)/providers/sqlite/*.xml.in
-       ./gen_emb_string$(EXEEXT_FOR_BUILD) $(top_srcdir)/providers/sqlite/*.xml.in > xml_embedded.h
-
 sqliteheaders = gda-sqlite-provider.h
 sqlitesources = \
        $(sqliteheaders) \
@@ -61,7 +55,7 @@ sqlitesources = \
        gda-symbols-util.h \
        gda-symbols-util.c
 
-BUILT_SOURCES = xml_embedded.h keywords_hash.code
+BUILT_SOURCES = keywords_hash.code
 
 libgda_sqlite_la_SOURCES = $(sqlitesources)
 libgda_sqlite_la_CFLAGS = -DPNAME=\""SQLite"\" -DCLASS_PREFIX=\""GdaSqlite"\" 
-DSEARCH_LIB_PATH=\""$(SQLITE_PATH)"\"
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 57758f178..468a64ec4 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -41,6 +41,7 @@
 #include <string.h>
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
+#include <gio/gio.h>
 #include <libgda/gda-data-model-array.h>
 #include <libgda/gda-data-model-private.h>
 #include <libgda/gda-util.h>
@@ -62,7 +63,6 @@
 #include <libgda/gda-statement-extra.h>
 #include <sql-parser/gda-sql-parser.h>
 #include <stdio.h>
-#include "xml_embedded.h" /* this one is dynamically generated */
 #define _GDA_PSTMT(x) ((GdaPStmt*)(x))
 #include <libgda/gda-debug-macros.h>
 
@@ -1220,16 +1220,18 @@ gda_sqlite_provider_render_operation (GdaServerProvider *provider, GdaConnection
        g_free (dir);
 
         if (! file) {
-               const gchar *contents;
-               contents = emb_get_file (str);
-               if (!contents) {
-                       g_set_error (error, GDA_SERVER_OPERATION_ERROR,
-                                    GDA_SERVER_OPERATION_XML_ERROR,
-                                    _("Missing spec. file '%s'"), str);
+               gchar *res = g_strconcat ("/spec/" PNAME, str);
+               GBytes *contents;
+               contents = g_resources_lookup_data (res,
+                                                   G_RESOURCE_LOOKUP_FLAGS_NONE,
+                                                   error);
+               g_free (res);
+               if (error != NULL) {
                        g_free (str);
                        return NULL;
                }
                /* else: TO_IMPLEMENT */
+               g_bytes_unref (contents);
         }
        else {
                g_free (str);


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