Skip to content

Commit 7bc82ab

Browse files
committed
Third pass at separating out connect options from query options
1 parent 9f6c906 commit 7bc82ab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/mysql2/client.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class Client
2525
def initialize(opts = {})
2626
opts = Mysql2::Util.key_hash_as_symbols(opts)
2727
@query_options = @@default_query_options.dup
28-
@query_options.merge! opts
28+
@query_options.merge! opts.select { |k, v| @@default_connect_options.has_key?(k) ? false : true }
2929
@connect_options = @@default_connect_options.dup
30-
@connect_options.merge! opts
30+
@connect_options.merge! opts.select { |k, v| @@default_connect_options.has_key?(k) ? true : false }
3131

3232
initialize_ext
3333

@@ -71,6 +71,7 @@ def initialize(opts = {})
7171
port = port.to_i unless port.nil?
7272
database = database.to_s unless database.nil?
7373
socket = socket.to_s unless socket.nil?
74+
flags = flags.to_i # if nil then 0
7475

7576
connect user, pass, host, port, database, socket, flags
7677
end

0 commit comments

Comments
 (0)