Skip to content

Commit a50e081

Browse files
committed
The server_status flags are enums in MySQL 8.0
1 parent 948e6f3 commit a50e081

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ext/mysql2/client.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,19 +1589,19 @@ void init_mysql2_client() {
15891589
void rb_mysql_set_server_query_flags(MYSQL *client, VALUE result) {
15901590
VALUE server_flags = rb_hash_new();
15911591

1592-
#ifdef SERVER_QUERY_NO_GOOD_INDEX_USED
1592+
#ifdef HAVE_CONST_SERVER_QUERY_NO_GOOD_INDEX_USED
15931593
rb_hash_aset(server_flags, sym_no_good_index_used, flag_to_bool(SERVER_QUERY_NO_GOOD_INDEX_USED));
15941594
#else
15951595
rb_hash_aset(server_flags, sym_no_good_index_used, Qnil);
15961596
#endif
15971597

1598-
#ifdef SERVER_QUERY_NO_INDEX_USED
1598+
#ifdef HAVE_CONST_SERVER_QUERY_NO_INDEX_USED
15991599
rb_hash_aset(server_flags, sym_no_index_used, flag_to_bool(SERVER_QUERY_NO_INDEX_USED));
16001600
#else
16011601
rb_hash_aset(server_flags, sym_no_index_used, Qnil);
16021602
#endif
16031603

1604-
#ifdef SERVER_QUERY_WAS_SLOW
1604+
#ifdef HAVE_CONST_SERVER_QUERY_WAS_SLOW
16051605
rb_hash_aset(server_flags, sym_query_was_slow, flag_to_bool(SERVER_QUERY_WAS_SLOW));
16061606
#else
16071607
rb_hash_aset(server_flags, sym_query_was_slow, Qnil);

ext/mysql2/extconf.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ def add_ssl_defines(header)
110110
add_ssl_defines(mysql_h)
111111
have_struct_member('MYSQL', 'net.vio', mysql_h)
112112
have_struct_member('MYSQL', 'net.pvio', mysql_h)
113+
# These constants are actually enums, so they cannot be detected by #ifdef in C code.
113114
have_const('MYSQL_ENABLE_CLEARTEXT_PLUGIN', mysql_h)
115+
have_const('SERVER_QUERY_NO_GOOD_INDEX_USED', mysql_h)
116+
have_const('SERVER_QUERY_NO_INDEX_USED', mysql_h)
117+
have_const('SERVER_QUERY_WAS_SLOW', mysql_h)
114118
have_const('MYSQL_OPT_CONNECT_ATTR_ADD', mysql_h) # for mysql_options4
115119

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

0 commit comments

Comments
 (0)