Module: kamailio
Branch: master
Commit: 9f459dccf84be7d7d0fbce89ca9165f7d1c4d66b
URL:
https://github.com/kamailio/kamailio/commit/9f459dccf84be7d7d0fbce89ca9165f…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2018-08-14T19:35:20+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
---
Modified: src/modules/db_mysql/km_my_con.c
Modified: src/modules/db_mysql/my_fld.h
---
Diff:
https://github.com/kamailio/kamailio/commit/9f459dccf84be7d7d0fbce89ca9165f…
Patch:
https://github.com/kamailio/kamailio/commit/9f459dccf84be7d7d0fbce89ca9165f…
---
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;