Skip to content

Commit

Permalink
Merge pull request #900 from sodabrew/mariadb_version_again
Browse files Browse the repository at this point in the history
Get MariaDB versions working again
  • Loading branch information
sodabrew authored Nov 11, 2017
2 parents b2cbe3e + a2e62e0 commit 151d5f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .travis_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ if [[ -n ${DB-} && x$DB =~ ^xmysql80 ]]; then
sudo bash .travis_mysql80.sh
fi

# Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.0 ]]; then
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
fi

# Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.1 ]]; then
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
fi

# Install MariaDB 10.2 if DB=mariadb10.2
# NOTE this is a workaround until Travis CI merges a fix to its mariadb addon.
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.2 ]]; then
Expand Down
8 changes: 5 additions & 3 deletions ext/mysql2/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ VALUE rb_hash_dup(VALUE other) {
* variable to use, but MYSQL_SERVER_VERSION gives the correct numbers when
* linking against the server itself
*/
#ifdef LIBMYSQL_VERSION
#if defined(MARIADB_CLIENT_VERSION_STR)
#define MYSQL_LINK_VERSION MARIADB_CLIENT_VERSION_STR
#elif defined(LIBMYSQL_VERSION)
#define MYSQL_LINK_VERSION LIBMYSQL_VERSION
#else
#define MYSQL_LINK_VERSION MYSQL_SERVER_VERSION
Expand Down Expand Up @@ -883,7 +885,7 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) {
retval = &boolval;
break;

#if defined(MYSQL_SECURE_AUTH)
#ifdef MYSQL_SECURE_AUTH
case MYSQL_SECURE_AUTH:
boolval = (value == Qfalse ? 0 : 1);
retval = &boolval;
Expand Down Expand Up @@ -1315,7 +1317,7 @@ static VALUE set_ssl_options(VALUE self, VALUE key, VALUE cert, VALUE ca, VALUE

static VALUE set_secure_auth(VALUE self, VALUE value) {
/* This option was deprecated in MySQL 5.x and removed in MySQL 8.0 */
#if defined(MYSQL_SECURE_AUTH)
#ifdef MYSQL_SECURE_AUTH
return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
#else
return Qfalse;
Expand Down
2 changes: 0 additions & 2 deletions ext/mysql2/mysql2_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ void Init_mysql2(void);
#include <mysql_com.h>
#include <errmsg.h>
#include <mysqld_error.h>
#include <mysql_version.h>
#else
#include <mysql/mysql.h>
#include <mysql/mysql_com.h>
#include <mysql/errmsg.h>
#include <mysql/mysqld_error.h>
#include <mysql/mysql_version.h>
#endif

#ifdef HAVE_RUBY_ENCODING_H
Expand Down

0 comments on commit 151d5f0

Please sign in to comment.