-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support get_server_public_key option #1377
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -996,6 +996,13 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) { | |
retval = charval; | ||
break; | ||
|
||
#ifdef HAVE_CONST_MYSQL_OPT_GET_SERVER_PUBLIC_KEY | ||
case MYSQL_OPT_GET_SERVER_PUBLIC_KEY: | ||
boolval = (value == Qfalse ? 0 : 1); | ||
retval = &boolval; | ||
break; | ||
#endif | ||
|
||
#ifdef HAVE_MYSQL_DEFAULT_AUTH | ||
case MYSQL_DEFAULT_AUTH: | ||
charval = (const char *)StringValueCStr(value); | ||
|
@@ -1485,6 +1492,14 @@ static VALUE set_init_command(VALUE self, VALUE value) { | |
return _mysql_client_options(self, MYSQL_INIT_COMMAND, value); | ||
} | ||
|
||
static VALUE set_get_server_public_key(VALUE self, VALUE value) { | ||
#ifdef HAVE_CONST_MYSQL_OPT_GET_SERVER_PUBLIC_KEY | ||
sodabrew marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return _mysql_client_options(self, MYSQL_OPT_GET_SERVER_PUBLIC_KEY, value); | ||
#else | ||
return Qfalse; | ||
#endif | ||
} | ||
|
||
static VALUE set_default_auth(VALUE self, VALUE value) { | ||
#ifdef HAVE_MYSQL_DEFAULT_AUTH | ||
return _mysql_client_options(self, MYSQL_DEFAULT_AUTH, value); | ||
|
@@ -1596,6 +1611,7 @@ void init_mysql2_client() { | |
rb_define_private_method(cMysql2Client, "default_file=", set_read_default_file, 1); | ||
rb_define_private_method(cMysql2Client, "default_group=", set_read_default_group, 1); | ||
rb_define_private_method(cMysql2Client, "init_command=", set_init_command, 1); | ||
rb_define_private_method(cMysql2Client, "get_server_public_key=", set_get_server_public_key, 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
rb_define_private_method(cMysql2Client, "default_auth=", set_default_auth, 1); | ||
rb_define_private_method(cMysql2Client, "ssl_set", set_ssl_options, 5); | ||
rb_define_private_method(cMysql2Client, "ssl_mode=", rb_set_ssl_mode_option, 1); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,7 @@ def add_ssl_defines(header) | |
have_const('SERVER_QUERY_WAS_SLOW', mysql_h) | ||
have_const('MYSQL_OPTION_MULTI_STATEMENTS_ON', mysql_h) | ||
have_const('MYSQL_OPTION_MULTI_STATEMENTS_OFF', mysql_h) | ||
have_const('MYSQL_OPT_GET_SERVER_PUBLIC_KEY', mysql_h) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not necessary to test for this constant into its own HAVE_ constant, because we can directly test for the constant at time of use (see suggested change) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sodabrew Hello, Thank you for reviewing my PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You’re absolutely right! |
||
|
||
# my_bool is replaced by C99 bool in MySQL 8.0, but we want | ||
# to retain compatibility with the typedef in earlier MySQLs. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.