File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
lib/active_record/connection_adapters/sqlserver Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1010- [ #812 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/812 ) Rails 6: Coerce ReloadModelsTest test on Windows
1111- [ #818 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/818 ) Handle false return by TinyTDS if connection fails and fixed CI
1212- [ #819 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/819 ) Fix Ruby 2.7 kwargs warnings
13+ - [ #825 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/825 ) Adjust error message when connection is dead
1314
1415#### Changed
1516
Original file line number Diff line number Diff line change @@ -353,10 +353,12 @@ def raw_connection_do(sql)
353353 case @connection_options [ :mode ]
354354 when :dblib
355355 result = @connection . execute ( sql )
356- # If connection fails then TinyTDS returns false instead of an exception (see https://github.com/rails-sqlserver/tiny_tds/issues/464)
357- if result == false
358- raise TinyTds ::Error , 'TinyTDS execute returned false instead of results'
359- end
356+
357+ # TinyTDS returns false instead of raising an exception if connection fails.
358+ # Getting around this by raising an exception ourselves while this PR
359+ # https://github.com/rails-sqlserver/tiny_tds/pull/469 is not released.
360+ raise TinyTds ::Error , 'failed to execute statement' if result . is_a? ( FalseClass )
361+
360362 result . do
361363 end
362364 ensure
You can’t perform that action at this time.
0 commit comments