lib/mysql2/client.rb in mysql2-0.2.6 vs lib/mysql2/client.rb in mysql2-0.2.7
- old
+ new
@@ -22,9 +22,14 @@
send(:"#{key}=", opts[key])
end
# force the encoding to utf8
self.charset_name = opts[:encoding] || 'utf8'
+ @read_timeout = opts[:read_timeout]
+ if @read_timeout and @read_timeout < 0
+ raise Mysql2::Error, "read_timeout must be a positive integer, you passed #{@read_timeout}"
+ end
+
ssl_set(*opts.values_at(:sslkey, :sslcert, :sslca, :sslcapath, :sslciper))
user = opts[:username]
pass = opts[:password]
host = opts[:host] || 'localhost'