Skip to content

Commit

Permalink
Make login timeout and query timeout backward database.yml friendly f…
Browse files Browse the repository at this point in the history
…or :dblib mode.
  • Loading branch information
metaskills committed Oct 31, 2010
1 parent e93ec04 commit 2ccb85c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

* 2-3-stable *

* Make login timeout and query timeout backward database.yml friendly for :dblib mode.


* 2.3.12 *

* Add multiple results set support with #execute_procedure for :dblib mode. [Ken Collins]
Expand Down
6 changes: 4 additions & 2 deletions lib/active_record/connection_adapters/sqlserver_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -814,15 +814,17 @@ def connect
@connection = case @connection_options[:mode]
when :dblib
appname = config[:appname] || Rails.application.class.name.split('::').first rescue nil
login_timeout = config[:login_timeout].present? ? config[:login_timeout].to_i : nil
timeout = config[:timeout].present? ? config[:timeout].to_i/1000 : nil
encoding = config[:encoding].present? ? config[:encoding] : nil
TinyTds::Client.new({
:dataserver => config[:dataserver],
:username => config[:username],
:password => config[:password],
:database => config[:database],
:appname => appname,
:login_timeout => config[:dblib_login_timeout],
:timeout => config[:dblib_timeout],
:login_timeout => login_timeout,
:timeout => timeout,
:encoding => encoding
}).tap do |client|
client.execute("SET ANSI_DEFAULTS ON").do
Expand Down

0 comments on commit 2ccb85c

Please sign in to comment.