[libgda/LIBGDA_5.2: 3/4] mdb-provider: Pass MdbHandle to the mdb_set_date_fmt() call




commit 144344c1112558cc6e5a1856586f83f4f2639acc
Author: Hans de Goede <hdegoede redhat com>
Date:   Sat Jul 10 13:37:11 2021 +0200

    mdb-provider: Pass MdbHandle to the mdb_set_date_fmt() call
    
    mdbtools >= 0.9.0 require a MdbHandle to be passed to the
    mdb_set_date_fmt() call. Move the call to directly after mdb_open()
    (when we first get the handle) and pass the handle to it.
    
    Note this change means that the mdb-provider will now no longer
    compile with older mdbtools versions. To enforce this the
    pkg-config check now checks for mdbtools >= 0.9 and the fallback
    to manual checking in /*/lib is removed, except for the case where
    the user has specified a path to check on the cmdline.

 m4/mdbtools.m4                   | 6 +-----
 providers/mdb/gda-mdb-provider.c | 3 ++-
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/m4/mdbtools.m4 b/m4/mdbtools.m4
index 448c550f7..7ca5b40c5 100644
--- a/m4/mdbtools.m4
+++ b/m4/mdbtools.m4
@@ -115,11 +115,7 @@ m4_define([_MDBTOOLS_CHECK_INTERNAL],
     # try with pkgconfig
     if test $try_mdb = true -a "x$mdb_test_dir" = x
     then
-       PKG_CHECK_MODULES(MDB, "libmdb",[pkgmdb=yes],[pkgmdb=no])
-       if test $pkgmdb = no
-       then
-           mdb_test_dir="/usr /usr/local /opt/gnome"
-       fi
+       PKG_CHECK_MODULES(MDB, [libmdb >= 0.9],[pkgmdb=yes],[pkgmdb=no])
     fi
 
     # try to locate files if pkg-config did not already do its job
diff --git a/providers/mdb/gda-mdb-provider.c b/providers/mdb/gda-mdb-provider.c
index c82a37aee..17660b75d 100644
--- a/providers/mdb/gda-mdb-provider.c
+++ b/providers/mdb/gda-mdb-provider.c
@@ -93,7 +93,6 @@ gda_mdb_provider_class_init (GdaMdbProviderClass *klass)
 static void
 gda_mdb_provider_init (GdaMdbProvider *myprv, GdaMdbProviderClass *klass)
 {
-       mdb_set_date_fmt ("%Y-%m-%d %H:%M:%S");
 }
 
 static void
@@ -301,6 +300,8 @@ gda_mdb_provider_open_connection (GdaServerProvider *provider, GdaConnection *cn
                return FALSE;
        }
 
+       mdb_set_date_fmt (cdata->mdb, "%Y-%m-%d %H:%M:%S");
+
        /* open virtual connection */
         if (! GDA_SERVER_PROVIDER_CLASS (parent_class)->open_connection (GDA_SERVER_PROVIDER (provider), 
cnc, params,
                                                                         NULL, NULL, NULL, NULL)) {


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