[anjuta] symbol-db: add support for libgda-6.0



commit 1f196dd119b41ce70f50c028946017e1c98d4d72
Author: inizan-yannick <inizan yannick gmail com>
Date:   Wed Apr 13 13:41:57 2016 +0200

    symbol-db: add support for libgda-6.0

 configure.ac                                |    9 +++++++--
 plugins/symbol-db/benchmark/libgda/libgda.c |   11 ++++++++++-
 plugins/symbol-db/symbol-db-engine-core.c   |   23 +++++++++++++++++++----
 3 files changed, 36 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6a64c53..488b6c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,7 @@ GTHREAD_REQUIRED=2.22.0
 GDK_PIXBUF_REQUIRED=2.0.0
 GDA4_REQUIRED=4.2.0
 GDA5_REQUIRED=5.0.0
+GDA6_REQUIRED=5.99.0
 LIBXML_REQUIRED=2.4.23
 GDL_REQUIRED=3.5.5
 LIBWNCK_REQUIRED=2.12
@@ -161,9 +162,13 @@ PKG_CHECK_MODULES([GDL],
    [gdl-3.0 >= $GDL_REQUIRED])
 
 PKG_CHECK_MODULES([GDA],
-   [libgda-5.0 >= $GDA5_REQUIRED],,
+   [libgda-6.0 >= $GDA6_REQUIRED], [
+               AC_DEFINE(HAVE_GDA6,[1],[libgda-6.0 support])
+       ],
    [PKG_CHECK_MODULES([GDA],
-      [libgda-4.0 >= $GDA4_REQUIRED])])
+      [libgda-5.0 >= $GDA5_REQUIRED],,
+         [PKG_CHECK_MODULES([GDA],
+            [libgda-4.0 >= $GDA4_REQUIRED])])])
 
 dnl Check for autogen
 dnl -----------------
diff --git a/plugins/symbol-db/benchmark/libgda/libgda.c b/plugins/symbol-db/benchmark/libgda/libgda.c
index 450488f..e35881c 100644
--- a/plugins/symbol-db/benchmark/libgda/libgda.c
+++ b/plugins/symbol-db/benchmark/libgda/libgda.c
@@ -1,3 +1,4 @@
+#include <config.h>
 #include <libgda/libgda.h>
 #include <gtk/gtk.h>
 #include <sql-parser/gda-sql-parser.h>
@@ -153,8 +154,12 @@ main (int argc, char *argv[])
 
        insert_data (cnc);      
 
-       
+#ifdef HAVE_GDA6
+       GError* err = NULL;
+       gda_connection_close (cnc, &err);
+#else
     gda_connection_close (cnc);
+#endif
        g_object_unref (cnc);
 
     return 0;
@@ -171,7 +176,11 @@ open_connection ()
 
        /* open connection */
     cnc = gda_connection_open_from_string ("SQLite", "DB_DIR=.;DB_NAME="DB_FILE, NULL,
+#ifdef HAVE_GDA6
+                                              GDA_CONNECTION_OPTIONS_NONE,
+#else
                                               GDA_CONNECTION_OPTIONS_THREAD_SAFE,
+#endif
                                               &error);
     if (!cnc) {
        g_print ("Could not open connection to SQLite database in example_db.db file: %s\n",
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index 8e33171..11e1ea4 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -24,6 +24,8 @@
  *     51 Franklin Street, Fifth Floor
  *     Boston, MA  02110-1301, USA.
  */
+ 
+#include <config.h>
 
 #include <time.h>
 #include <unistd.h>
@@ -528,8 +530,16 @@ sdb_engine_disconnect_from_db (SymbolDBEngine * dbe)
        g_free (priv->cnc_string);
        priv->cnc_string = NULL;
 
-       if (priv->db_connection != NULL)
+       if (priv->db_connection != NULL) {
+#ifdef HAVE_GDA6
+               GError* err = NULL;
+               gda_connection_close (priv->db_connection, &err);
+               if (err != NULL)
+                       return FALSE;
+#else
                gda_connection_close (priv->db_connection);
+#endif
+       }
        priv->db_connection = NULL;
 
        if (priv->sql_parser != NULL)
@@ -2452,9 +2462,14 @@ sdb_engine_connect_to_db (SymbolDBEngine * dbe, const gchar *cnc_string, GError
        /* establish a connection. If the sqlite file does not exist it will 
         * be created 
         */
-       priv->db_connection = gda_connection_open_from_string ("SQLite", cnc_string, NULL, 
-                                                                                  
GDA_CONNECTION_OPTIONS_THREAD_SAFE, error);
-       
+       priv->db_connection = gda_connection_open_from_string ("SQLite", cnc_string, NULL,
+#ifdef HAVE_GDA6
+                                                                                       
GDA_CONNECTION_OPTIONS_NONE,
+#else
+                                                                                       
GDA_CONNECTION_OPTIONS_THREAD_SAFE,
+#endif                                                                         
+                                                                                       error);
+                                                                               
        if (!GDA_IS_CONNECTION (priv->db_connection))
        {
                g_warning ("Could not open connection to %s\n", cnc_string);


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