add some more defaults to the connect flags

This commit is contained in:
Brian Lopez 2010-10-14 23:38:25 -07:00
parent a6b5e9c28c
commit c394122fd9
2 changed files with 9 additions and 4 deletions

View File

@ -9,7 +9,7 @@ module Mysql2
:database_timezone => :local, # timezone Mysql2 will assume datetime objects are stored in :database_timezone => :local, # timezone Mysql2 will assume datetime objects are stored in
:application_timezone => nil, # timezone Mysql2 will convert to before handing the object back to the caller :application_timezone => nil, # timezone Mysql2 will convert to before handing the object back to the caller
:cache_rows => true, # tells Mysql2 to use it's internal row cache for results :cache_rows => true, # tells Mysql2 to use it's internal row cache for results
:connect_flags => REMEMBER_OPTIONS :connect_flags => REMEMBER_OPTIONS | LONG_PASSWORD | LONG_FLAG | TRANSACTIONS | PROTOCOL_41 | SECURE_CONNECTION
} }
def initialize(opts = {}) def initialize(opts = {})

View File

@ -23,10 +23,10 @@ describe Mysql2::Client do
end end
end end
client = klient.new :flags => Mysql2::Client::FOUND_ROWS client = klient.new :flags => Mysql2::Client::FOUND_ROWS
client.connect_args.last.last.should == Mysql2::Client::FOUND_ROWS (client.connect_args.last.last & Mysql2::Client::FOUND_ROWS).should be_true
end end
it "should default flags to 0" do it "should default flags to (REMEMBER_OPTIONS, LONG_PASSWORD, LONG_FLAG, TRANSACTIONS, PROTOCOL_41, SECURE_CONNECTION)" do
klient = Class.new(Mysql2::Client) do klient = Class.new(Mysql2::Client) do
attr_reader :connect_args attr_reader :connect_args
def connect *args def connect *args
@ -35,7 +35,12 @@ describe Mysql2::Client do
end end
end end
client = klient.new client = klient.new
client.connect_args.last.last.should == 0 (client.connect_args.last.last & (Mysql2::Client::REMEMBER_OPTIONS |
Mysql2::Client::LONG_PASSWORD |
Mysql2::Client::LONG_FLAG |
Mysql2::Client::TRANSACTIONS |
Mysql2::Client::PROTOCOL_41 |
Mysql2::Client::SECURE_CONNECTION)).should be_true
end end
it "should have a global default_query_options hash" do it "should have a global default_query_options hash" do