codelite icon indicating copy to clipboard operation
codelite copied to clipboard

[Bug]: compile issue on mysql > 8

Open grandinj opened this issue 1 year ago • 1 comments

What happened?

Does not compile on latest Ubuntu

Version

Self compiled

Operating system

Linux

Steps to reproduce

compile produces output like

/home/noel/codelite/sdk/databaselayer/./include/wx/dblayer/include/../include/MysqlPreparedStatementParameter.h:65:3: error: ‘my_bool’ does not name a type; did you mean ‘bool’?
   65 |   my_bool m_bIsNull;

Which is fixable like this:

diff --git a/sdk/databaselayer/include/wx/dblayer/include/MysqlInterface.h b/sdk/databaselayer/include/wx/dblayer/include/MysqlInterface.h
index 747c84ca8..95c6cce0c 100644
--- a/sdk/databaselayer/include/wx/dblayer/include/MysqlInterface.h
+++ b/sdk/databaselayer/include/wx/dblayer/include/MysqlInterface.h
@@ -16,6 +16,12 @@
 
 #include "mysql.h"
 
+// MySQL dropped the my_bool typedef in version 8.0.1
+// https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-1.html#mysqld-8-0-1-compiling
+#if MYSQL_VERSION_ID > 80000
+    typedef bool my_bool;
+#endif
+
 typedef void (STDCALL *MysqlServerEndType)(void);
 typedef MYSQL* (STDCALL *MysqlInitType)(MYSQL*);
 typedef MYSQL* (STDCALL *MysqlRealConnectType)(MYSQL*, const char*, const char*,
diff --git a/sdk/databaselayer/include/wx/dblayer/include/MysqlPreparedStatementParameter.h b/sdk/databaselayer/include/wx/dblayer/include/MysqlPreparedStatementParameter.h
index c6296d604..8af58d7aa 100644
--- a/sdk/databaselayer/include/wx/dblayer/include/MysqlPreparedStatementParameter.h
+++ b/sdk/databaselayer/include/wx/dblayer/include/MysqlPreparedStatementParameter.h
@@ -20,6 +20,12 @@
 #include "DatabaseErrorReporter.h"
 #include "DatabaseStringConverter.h"
 
+// MySQL dropped the my_bool typedef in version 8.0.1
+// https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-1.html#mysqld-8-0-1-compiling
+#if MYSQL_VERSION_ID > 80000
+    typedef bool my_bool;
+#endif
+
 typedef struct bind_data {
   wxString strValue;
   int nValue;

Relevant log output

No response

grandinj avatar Oct 30 '24 08:10 grandinj

As a note, I have found https://github.com/mtangoo/wxDatabase which seems to be the successor of DatabaseLayer, but it seems not ready to be replaced as-is (as submodule).

Extra note, MySql support is optional (for Database Explorer plugin) and can be disable in CMake with -DWITH_MYSQL=0

Jarod42 avatar Oct 30 '24 18:10 Jarod42