From 71b5eab6829671cad72869fa0a33fbb1ef6ff447 Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Sun, 2 Jul 2017 18:54:49 -0400 Subject: [PATCH 1/2] Add ifdefs for MySQL 5.1 without MYSQL_ENABLE_CLEARTEXT_PLUGIN --- ext/mysql2/client.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/mysql2/client.c b/ext/mysql2/client.c index 97231ff17..05fd07032 100644 --- a/ext/mysql2/client.c +++ b/ext/mysql2/client.c @@ -903,10 +903,12 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) { retval = charval; break; +#ifdef MYSQL_ENABLE_CLEARTEXT_PLUGIN case MYSQL_ENABLE_CLEARTEXT_PLUGIN: boolval = (value == Qfalse ? 0 : 1); retval = &boolval; break; +#endif default: return Qfalse; @@ -1326,7 +1328,11 @@ static VALUE set_init_command(VALUE self, VALUE value) { } static VALUE set_enable_cleartext_plugin(VALUE self, VALUE value) { +#ifdef MYSQL_ENABLE_CLEARTEXT_PLUGIN return _mysql_client_options(self, MYSQL_ENABLE_CLEARTEXT_PLUGIN, value); +#else + rb_raise(cMysql2Error, "enable-cleartext-plugin is not available, you may need a newer MySQL client library"); +#endif } static VALUE initialize_ext(VALUE self) { From f56638413b3ac0cf869cd16357e5d84f49ca0934 Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Mon, 3 Jul 2017 11:06:21 -0400 Subject: [PATCH 2/2] Travis CI add Percona MySQL 5.1 to the matrix --- .travis.yml | 9 +++++++++ .travis_mysql51.sh | 11 +++++++++++ .travis_setup.sh | 5 +++++ 3 files changed, 25 insertions(+) create mode 100644 .travis_mysql51.sh diff --git a/.travis.yml b/.travis.yml index a5f4ae753..07fb7e175 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,6 +67,12 @@ matrix: mariadb: 10.2 hosts: - mysql2gem.example.com + - rvm: 2.0.0 + env: DB=mysql51 + dist: precise + addons: + hosts: + - mysql2gem.example.com - rvm: 2.0.0 env: DB=mysql55 dist: precise @@ -105,3 +111,6 @@ matrix: - os: osx rvm: system env: DB=mysql56 + - rvm: 2.0.0 + env: DB=mysql51 + dist: precise diff --git a/.travis_mysql51.sh b/.travis_mysql51.sh new file mode 100644 index 000000000..bc3da3dd6 --- /dev/null +++ b/.travis_mysql51.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -eux + +apt-get purge -qq '^mysql*' '^libmysql*' +rm -fr /etc/mysql +rm -fr /var/lib/mysql +apt-key adv --keyserver keys.gnupg.net --recv-keys 8507EFA5 +add-apt-repository 'deb http://repo.percona.com/apt precise main' +apt-get update -qq +apt-get install -qq percona-server-server-5.1 percona-server-client-5.1 libmysqlclient16-dev diff --git a/.travis_setup.sh b/.travis_setup.sh index ffe5295b5..fe114c68e 100644 --- a/.travis_setup.sh +++ b/.travis_setup.sh @@ -2,6 +2,11 @@ set -eux +# Install MySQL 5.1 if DB=mysql51 +if [[ -n ${DB-} && x$DB =~ ^xmysql51 ]]; then + sudo bash .travis_mysql51.sh +fi + # Install MySQL 5.7 if DB=mysql57 if [[ -n ${DB-} && x$DB =~ ^xmysql57 ]]; then sudo bash .travis_mysql57.sh