Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #313 from darrenli/connection-type-casting

Cast connection options to correct datatype.
  • Loading branch information...
commit 3385de30c87b3c6a78bc76724b62e23905edd2e6 2 parents 560bed8 + 26d07e6
@brianmario authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/mysql2/client.rb
View
9 lib/mysql2/client.rb
@@ -23,7 +23,14 @@ def initialize(opts = {})
# Set MySQL connection options (each one is a call to mysql_options())
[:reconnect, :connect_timeout, :local_infile, :read_timeout, :write_timeout].each do |key|
next unless opts.key?(key)
- send(:"#{key}=", opts[key])
+ case key
+ when :reconnect, :local_infile
+ send(:"#{key}=", !!opts[key])
+ when :connect_timeout, :read_timeout, :write_timeout
+ send(:"#{key}=", opts[key].to_i)
+ else
+ send(:"#{key}=", opts[key])
+ end
end
# force the encoding to utf8
Please sign in to comment.
Something went wrong with that request. Please try again.