[sr-dev] git:5.0:5b31b870: db_mysql: improved fix in commit 1736723cc2a15 - it did not worked for mariadb

Henning Westerholt hw at kamailio.org
Wed Aug 15 21:22:42 CEST 2018


Module: kamailio
Branch: 5.0
Commit: 5b31b87040127631077ada485f54f8a1ae8395f4
URL: https://github.com/kamailio/kamailio/commit/5b31b87040127631077ada485f54f8a1ae8395f4

Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-08-15T21:22:11+02:00

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

(cherry picked from commit 9f459dccf84be7d7d0fbce89ca9165f7d1c4d66b)

---

Modified: src/modules/db_mysql/km_my_con.c
Modified: src/modules/db_mysql/my_fld.h

---

Diff:  https://github.com/kamailio/kamailio/commit/5b31b87040127631077ada485f54f8a1ae8395f4.diff
Patch: https://github.com/kamailio/kamailio/commit/5b31b87040127631077ada485f54f8a1ae8395f4.patch

---

diff --git a/src/modules/db_mysql/km_my_con.c b/src/modules/db_mysql/km_my_con.c
index 242329e295..9d6566204d 100644
--- a/src/modules/db_mysql/km_my_con.c
+++ b/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) {
diff --git a/src/modules/db_mysql/my_fld.h b/src/modules/db_mysql/my_fld.h
index 539a4df699..c247e48407 100644
--- a/src/modules/db_mysql/my_fld.h
+++ b/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;




More information about the sr-dev mailing list