[libgda/LIBGDA_5.2] MySQL: adding support for version 8 API



commit e1aea5ffb3fd9b49ad8c0dc01a915b47de3dc3d2
Author: Daniel Espinosa <esodan gmail com>
Date:   Tue Oct 8 18:16:51 2019 -0500

    MySQL: adding support for version 8 API

 m4/mysql.m4                          | 21 +++++++++++++++++++++
 providers/mysql/Makefile.am          |  5 +++++
 providers/mysql/gda-mysql-provider.c |  3 +++
 3 files changed, 29 insertions(+)
---
diff --git a/m4/mysql.m4 b/m4/mysql.m4
index c3a16319d..79d4d173f 100644
--- a/m4/mysql.m4
+++ b/m4/mysql.m4
@@ -103,6 +103,7 @@ m4_define([_MYSQL_CHECK_INTERNAL],
            pkgmysql=yes
            MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
            MYSQL_LIBS=`$MYSQL_CONFIG --libs`
+           mysql_version=`$MYSQL_CONFIG --version`
        else
            mysql_test_dir="/usr /usr/local /opt/gnome"
        fi
@@ -204,6 +205,26 @@ int main() {
     AM_CONDITIONAL(MYSQL,[test "$mysql_found" = "yes"])
     AC_SUBST(MYSQL_LIBS)
     AC_SUBST(MYSQL_CFLAGS)
+dnl Try detect API version
+    AC_MSG_CHECKING([checking for Mysql API version])
+    AX_COMPARE_VERSION($mysql_version, [lt], [8.0.0],
+       [
+               mysql5=yes
+               AC_MSG_RESULT([Using MySQL 5 API])
+       ],[
+               mysql5=no
+               AC_MSG_RESULT([Using MySQL API for version $mysql_version])
+               AC_MSG_CHECKING([checking for Mysql 8 API version])
+               AX_COMPARE_VERSION($mysql_version, [ge], [8.0.0],
+                       [
+                               mysql8=yes
+                       ],[
+                               mysql8=no
+                       ])
+               AC_MSG_RESULT([$mysql8])
+       ])
+    AM_CONDITIONAL(MYSQL5,[test "x$mysql5" = "xyes"])
+    AM_CONDITIONAL(MYSQL8,[test "x$mysql8" = "xyes"])
 ])
 
 
diff --git a/providers/mysql/Makefile.am b/providers/mysql/Makefile.am
index 839ed8c60..c64c34f75 100644
--- a/providers/mysql/Makefile.am
+++ b/providers/mysql/Makefile.am
@@ -11,6 +11,11 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/providers/reuseable/mysql \
        $(COREDEPS_CFLAGS) $(COREDEPS_WFLAGS) $(MYSQL_CFLAGS) -DCLASS_PREFIX=\""GdaMySQL"\"
 
+if MYSQL8
+AM_CPPFLAGS += \
+       -DMYSQL8
+endif
+
 gda-mysql-handler-bin.c: $(top_srcdir)/libgda/sqlite/gda-sqlite-handler-bin.c
        cat $(top_srcdir)/libgda/sqlite/gda-sqlite-handler-bin.c | sed -e 's/SQLITE/MYSQL/g' -e 
's/sqlite/mysql/g' -e 's/Sqlite/Mysql/g' -e 's/SQLite/MySQL/g' > gda-mysql-handler-bin.c
 
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 39aea5f95..8d08aa100 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -61,6 +61,9 @@
 
 #define _GDA_PSTMT(x) ((GdaPStmt*)(x))
 
+#ifdef MYSQL8
+typedef bool my_bool;
+#endif
 /*
  * GObject methods
  */


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