Skip to content

Commit

Permalink
Merge pull request #1304 from sodabrew/mysql-5.6.36-ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew authored Jan 21, 2023
2 parents ad56ca4 + e9decbe commit 6528137
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ext/mysql2/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ struct nogvl_select_db_args {
static VALUE rb_set_ssl_mode_option(VALUE self, VALUE setting) {
unsigned long version = mysql_get_client_version();

if (version < 50703) {
rb_warn( "Your mysql client library does not support setting ssl_mode; full support comes with 5.7.11." );
if (version < 50630 || (version >= 50700 && version < 50703)) {
rb_warn( "Your mysql client library does not support setting ssl_mode; full support comes with 5.6.36+, 5.7.11+, 8.0+" );
return Qnil;
}
#if defined(HAVE_CONST_MYSQL_OPT_SSL_VERIFY_SERVER_CERT) || defined(HAVE_CONST_MYSQL_OPT_SSL_ENFORCE)
Expand Down Expand Up @@ -1723,7 +1723,7 @@ void init_mysql2_client() {
rb_const_set(cMysql2Client, rb_intern("SESSION_TRACK_TRANSACTION_STATE"), INT2NUM(SESSION_TRACK_TRANSACTION_STATE));
#endif

#if defined(FULL_SSL_MODE_SUPPORT) // MySQL 5.7.11 and above
#if defined(FULL_SSL_MODE_SUPPORT) // MySQL 5.6.36 and MySQL 5.7.11 and above
rb_const_set(cMysql2Client, rb_intern("SSL_MODE_DISABLED"), INT2NUM(SSL_MODE_DISABLED));
rb_const_set(cMysql2Client, rb_intern("SSL_MODE_PREFERRED"), INT2NUM(SSL_MODE_PREFERRED));
rb_const_set(cMysql2Client, rb_intern("SSL_MODE_REQUIRED"), INT2NUM(SSL_MODE_REQUIRED));
Expand Down
2 changes: 2 additions & 0 deletions ext/mysql2/result.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ static size_t rb_mysql_result_memsize(const void * wrapper) {
return memsize;
}

#ifdef HAVE_RB_GC_MARK_MOVABLE
static void rb_mysql_result_compact(void * wrapper) {
mysql2_result_wrapper * w = wrapper;
if (w) {
Expand All @@ -153,6 +154,7 @@ static void rb_mysql_result_compact(void * wrapper) {
rb_mysql2_gc_location(w->statement);
}
}
#endif

static const rb_data_type_t rb_mysql_result_type = {
"rb_mysql_result",
Expand Down
2 changes: 2 additions & 0 deletions ext/mysql2/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ static size_t rb_mysql_stmt_memsize(const void * ptr) {
return sizeof(*stmt_wrapper);
}

#ifdef HAVE_RB_GC_MARK_MOVABLE
static void rb_mysql_stmt_compact(void * ptr) {
mysql_stmt_wrapper *stmt_wrapper = ptr;
if (!stmt_wrapper) return;

rb_mysql2_gc_location(stmt_wrapper->client);
}
#endif

static const rb_data_type_t rb_mysql_statement_type = {
"rb_mysql_statement",
Expand Down

0 comments on commit 6528137

Please sign in to comment.