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 <rafaeldtinoco@ubuntu.com>
This commit is contained in:
Rafael David Tinoco 2019-08-20 02:38:47 +00:00
parent e986d6ba53
commit 17a7cb8735

View File

@ -3,6 +3,8 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#ifndef _mysql_h
struct st_mysql; struct st_mysql;
using MYSQL = st_mysql; using MYSQL = st_mysql;
@ -14,7 +16,7 @@ using MYSQL_ROW = char**;
struct st_mysql_field; struct st_mysql_field;
using MYSQL_FIELD = st_mysql_field; using MYSQL_FIELD = st_mysql_field;
#endif
namespace mysqlxx namespace mysqlxx
{ {