Comment 3 for bug 1840511

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

@gianfranco:

https://github.com/yandex/ClickHouse/issues/6552

Based on the upstream discussion, I think upstream change should be:

----

From cc17b8f0687d0b290e7a543032a87ca289290563 Mon Sep 17 00:00:00 2001
From: Rafael David Tinoco <email address hidden>
Date: Tue, 20 Aug 2019 02:38:47 +0000
Subject: [PATCH 2/2] MySQL 8 integration requires previous declaration checks

C and C++ differ in the form of types being defined. While C++ structs
are defined also as new types, in C you have to explicitly typedef the
struct to have a new type.

Fir this case, it was enough to check if MySQL header was already
defined in order not to re-declare MYSQL, MYSQL_RES, MYSQL_ROW and
MYSQL_FIELD.

Signed-off-by: Rafael David Tinoco <email address hidden>
---
 libs/libmysqlxx/include/mysqlxx/Types.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libs/libmysqlxx/include/mysqlxx/Types.h b/libs/libmysqlxx/include/mysqlxx/Types.h
index 30abdeb..b5ed709 100644
--- a/libs/libmysqlxx/include/mysqlxx/Types.h
+++ b/libs/libmysqlxx/include/mysqlxx/Types.h
@@ -3,6 +3,8 @@
 #include <cstdint>
 #include <string>

+#ifndef _mysql_h
+
 struct st_mysql;
 using MYSQL = st_mysql;

@@ -14,7 +16,7 @@ using MYSQL_ROW = char**;
 struct st_mysql_field;
 using MYSQL_FIELD = st_mysql_field;

-
+#endif

 namespace mysqlxx
 {
--
2.20.1

----

instead. Im proposing that to upstream, just so you are aware for the next merge!