Skip to content

Commit

Permalink
The server_status flags are enums in MySQL 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Nov 25, 2017
1 parent 948e6f3 commit a50e081
Show file tree
Hide file tree
Showing 2 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 @@ -1589,19 +1589,19 @@ void init_mysql2_client() {
void rb_mysql_set_server_query_flags(MYSQL *client, VALUE result) {
VALUE server_flags = rb_hash_new();

#ifdef SERVER_QUERY_NO_GOOD_INDEX_USED
#ifdef HAVE_CONST_SERVER_QUERY_NO_GOOD_INDEX_USED
rb_hash_aset(server_flags, sym_no_good_index_used, flag_to_bool(SERVER_QUERY_NO_GOOD_INDEX_USED));
#else
rb_hash_aset(server_flags, sym_no_good_index_used, Qnil);
#endif

#ifdef SERVER_QUERY_NO_INDEX_USED
#ifdef HAVE_CONST_SERVER_QUERY_NO_INDEX_USED
rb_hash_aset(server_flags, sym_no_index_used, flag_to_bool(SERVER_QUERY_NO_INDEX_USED));
#else
rb_hash_aset(server_flags, sym_no_index_used, Qnil);
#endif

#ifdef SERVER_QUERY_WAS_SLOW
#ifdef HAVE_CONST_SERVER_QUERY_WAS_SLOW
rb_hash_aset(server_flags, sym_query_was_slow, flag_to_bool(SERVER_QUERY_WAS_SLOW));
#else
rb_hash_aset(server_flags, sym_query_was_slow, Qnil);
Expand Down
4 changes: 4 additions & 0 deletions ext/mysql2/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ def add_ssl_defines(header)
add_ssl_defines(mysql_h)
have_struct_member('MYSQL', 'net.vio', mysql_h)
have_struct_member('MYSQL', 'net.pvio', mysql_h)
# These constants are actually enums, so they cannot be detected by #ifdef in C code.
have_const('MYSQL_ENABLE_CLEARTEXT_PLUGIN', mysql_h)
have_const('SERVER_QUERY_NO_GOOD_INDEX_USED', mysql_h)
have_const('SERVER_QUERY_NO_INDEX_USED', mysql_h)
have_const('SERVER_QUERY_WAS_SLOW', mysql_h)
have_const('MYSQL_OPT_CONNECT_ATTR_ADD', mysql_h) # for mysql_options4

# This is our wishlist. We use whichever flags work on the host.
Expand Down

0 comments on commit a50e081

Please sign in to comment.