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

cppdb and MySQL 8 #70

Closed
dreaming-augustin opened this issue Feb 18, 2020 · 1 comment · Fixed by artyom-beilis/cppdb#3
Closed

cppdb and MySQL 8 #70

dreaming-augustin opened this issue Feb 18, 2020 · 1 comment · Fixed by artyom-beilis/cppdb#3

Comments

@dreaming-augustin
Copy link
Collaborator

The mysql back end no longer compiles with the latest MySQL 8.

There are two sets of changes to make.

my_bool

The first one is straight forward: the type my_bool has been removed in MySQL 8.0. Simply replace all instances of my_bool with bool in drivers/mysql_backend.cpp

embedded server

The second one is more problematic: MySQL removed the embedded server.

See announcement here:
MySQL 8.0: Retiring support for libmysqld https://mysqlserverteam.com/mysql-8-0-retiring-support-for-libmysqld/

Old documentation: https://dev.mysql.com/doc/refman/5.7/en/libmysqld.html

Removal notice: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-1.html#mysqld-8-0-1-deprecation-removal

During compilation, we get the following errors as a result:

cppdb/drivers/mysql_backend.cpp:1203:22: error: ‘MYSQL_OPT_GUESS_CONNECTION’ was not declared in this scope;
cppdb/drivers/mysql_backend.cpp:1240:21: error: ‘MYSQL_SET_CLIENT_IP’ was not declared in this scope;
cppdb/drivers/mysql_backend.cpp:1245:22: error: ‘MYSQL_OPT_SSL_VERIFY_SERVER_CERT’ was not declared in this scope;
cppdb/drivers/mysql_backend.cpp:1250:22: error: ‘MYSQL_OPT_USE_EMBEDDED_CONNECTION’ was not declared in this scope;
cppdb/drivers/mysql_backend.cpp:1255:22: error: ‘MYSQL_OPT_USE_REMOTE_CONNECTION’ was not declared in this scope;
cppdb/drivers/mysql_backend.cpp:1281:22: error: ‘MYSQL_SECURE_AUTH’ was not declared in this scope;

I do not use the embedded mysql server, so for me, the hackish way to get cppdb to compile was to use include guards:

     #if MYSQL_VERSION_ID < 80000
     ....
    #endif

like this:

                #if MYSQL_VERSION_ID < 80000
                if(ci.has("secure_auth")) {
                        if(unsigned secure = ci.get("secure_auth", 1)) {
                                bool value = secure;
                                mysql_set_option(MYSQL_SECURE_AUTH, &value);
                        }
                }
                #endif

Obviously, a proper fix would require much more extensive changes, with more include guards, or a complete removal of all the code related to the embedded mysql server.

I hope it helps some.

@dreaming-augustin
Copy link
Collaborator Author

I attached the relevant patches to the related Gentoo issue:
https://bugs.gentoo.org/710132

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

Successfully merging a pull request may close this issue.

1 participant