Skip to content
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

Ensure connection flags are supported #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

donncha
Copy link

@donncha donncha commented Feb 28, 2023

Discovered that connection flags were not being passed to the client with Rails.

The flag parsing in Mysql2::Client first checks if the constant is defined before setting the flag, and this was failing as the original client had been swapped out, leading to the odd situation where you could see the value of the constant, but it was saying it wasn't defined.

irb> Mysql2::Client.const_get("MULTI_STATEMENTS")
=> 65536
irb> Mysql2::Client.const_defined?("MULTI_STATEMENTS")
=> true

Solution is to also delegate const_defined? to the origin client.

@vladimir-mencl-eresearch

Hi,

I'm running into the same issue in projects setting ssl_mode connection parameter.

The Mysql2::Client first checks the ssl_mode value with const_defined? before resolving it with Client.const_get:

return Mysql2::Client.const_get(m) if Mysql2::Client.const_defined?(m)

... and so it ends up evaluating all ssl_mode values as invalid.

This PR would solve it - @alfa-jpn , would you please consider merging it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants