Browse Source

db_mysql: improved fix in commit 1736723cc2a15 - it did not worked for mariadb

- improved fix in commit 1736723cc2a15 - it did not worked for mariadb
- Reason is that MariaDB increased its numbering scheme, they are now at 10.x
- MariaDB 10 is still using my_bool type, added few more #ifs to fix this
Henning Westerholt 7 years ago
parent
commit
9f459dccf8
2 changed files with 17 additions and 0 deletions
  1. 9 0
      src/modules/db_mysql/km_my_con.c
  2. 8 0
      src/modules/db_mysql/my_fld.h

+ 9 - 0
src/modules/db_mysql/km_my_con.c

@@ -29,7 +29,12 @@
 #include "km_my_con.h"
 #include "km_db_mysql.h"
 #include <mysql.h>
+
+/* MariaDB exports MYSQL_VERSION_ID as well, but changed numbering scheme */
+#if MYSQL_VERSION_ID > 80000 && ! defined MARIADB_BASE_VERSION
 #include <stdbool.h>
+#endif
+
 #include "../../core/mem/mem.h"
 #include "../../core/dprint.h"
 #include "../../core/ut.h"
@@ -45,7 +50,11 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
 	char *host, *grp, *egrp;
 	unsigned int connection_flag = 0;
 #if MYSQL_VERSION_ID > 50012
+#if MYSQL_VERSION_ID > 80000 && ! defined MARIADB_BASE_VERSION
 	bool rec;
+#else
+        my_bool rec;
+#endif
 #endif
 
 	if (!id) {

+ 8 - 0
src/modules/db_mysql/my_fld.h

@@ -29,13 +29,21 @@
 #include "../../lib/srdb2/db_drv.h"
 #include "../../lib/srdb2/db_fld.h"
 #include <mysql.h>
+
+/* MariaDB exports MYSQL_VERSION_ID as well, but changed numbering */
+#if MYSQL_VERSION_ID > 80000 && ! defined MARIADB_BASE_VERSION
 #include <stdbool.h>
+#endif
 
 struct my_fld {
 	db_drv_t gen;
 
 	char* name;
+#if MYSQL_VERSION_ID > 80000 && ! defined MARIADB_BASE_VERSION
 	bool is_null;
+#else
+	my_bool is_null;
+#endif
 	MYSQL_TIME time;
 	unsigned long length;
 	str buf;