Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MySQL 8 #13

Open
Leonidas-from-XIV opened this issue Jun 20, 2018 · 5 comments
Open

Support MySQL 8 #13

Leonidas-from-XIV opened this issue Jun 20, 2018 · 5 comments

Comments

@Leonidas-from-XIV
Copy link

What I have found was that my_bool was replaced by bool from stdbool.h, and MYSQL_SECURE_AUTH is now default and can't be selected and the VERIFY_CERTIFICATE options changed.

Maybe more. I don't quite know what the policy on supporting older versions of MySQL with this library is.

@ygrek
Copy link
Owner

ygrek commented Nov 12, 2019

if you have a patch to make it work with oracle mysql I will be happy to integrate it

@LocutusOfBorg
Copy link

Hello, what we are using in Ubuntu is a couple of patches:
(this one should probably be changed in "sed s/my_bool/bool/g -i mysql_stubs.c", since we have only 7 total references to that old my_bool variable type)

Description: Reintroduce my_bool to fix build with MySQL 8
 (patch inspired from the one in cppdb 0.3.1+dfsg-8ubuntu2)
Author: Gianfranco Costamagna <locutusofborg@debian.org>, Andreas Hasenack <andreas@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1863026
Forwarded: no
Last-Update: 2020-02-21

--- mysql-ocaml-1.2.1.orig/mysql_stubs.c
+++ mysql-ocaml-1.2.1/mysql_stubs.c
@@ -71,6 +71,7 @@
 #define STMTval(x) (*(MYSQL_STMT**)Data_custom_val(x))
 #define ROWval(x) (*(row_t**)Data_custom_val(x))
 
+typedef bool my_bool;
 static void mysqlfailwith(char *err) Noreturn;
 static void mysqlfailmsg(const char *fmt, ...) Noreturn;
 

and the second one is:

Description: Drop support for options removed in MySQL 8.0
 These are no longer available in MySQL 8.0. There is already an "unknown
 option" default case, so it should be safe security-wise: anything still
 requesting these options will correctly fail.
Author: Robie Basak <robie.basak@canonical.com>
Origin: vendor
Forwarded: no
X-Not-Forwarded-Reason: work still in progress
Last-Update: 2018-07-16

--- a/mysql_stubs.c
+++ b/mysql_stubs.c
@@ -227,9 +227,13 @@
         {
           case  0: SET_OPTION_BOOL(OPT_LOCAL_INFILE);
           case  1: SET_OPTION_BOOL(OPT_RECONNECT);
+#if defined(MARIADB_BASE_VERSION) || MYSQL_VERSION_ID < 80000
           case  2: SET_OPTION_BOOL(OPT_SSL_VERIFY_SERVER_CERT);
+#endif
           case  3: SET_OPTION_BOOL(REPORT_DATA_TRUNCATION);
+#if defined(MARIADB_BASE_VERSION) || MYSQL_VERSION_ID < 80000
           case  4: SET_OPTION_BOOL(SECURE_AUTH);
+#endif
           case  5: SET_OPTION(OPT_PROTOCOL, &ml_mysql_protocol_type[Int_val(v)]);
           case  6: SET_OPTION_INT(OPT_CONNECT_TIMEOUT);
           case  7: SET_OPTION_INT(OPT_READ_TIMEOUT);

@kit-ty-kate
Copy link

ping @ygrek (see also ocaml/opam-repository#22402)

I don't want to add patches to opam-repository and would much prefer if upstream could do a release instead

@kit-ty-kate
Copy link

ping @ygrek

@edwintorok
Copy link

FWIW a workaround on Ubuntu 22.04 is to do this (instead of what opam recommends by default): apt install libmariadb-dev-compat. That will install a mysql library that is compatible with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants