File tree 2 files changed +7
-4
lines changed
lib/active_record/connection_adapters/sqlserver
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 10
10
- [ #812 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/812 ) Rails 6: Coerce ReloadModelsTest test on Windows
11
11
- [ #818 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/818 ) Handle false return by TinyTDS if connection fails and fixed CI
12
12
- [ #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
13
14
14
15
#### Changed
15
16
Original file line number Diff line number Diff line change @@ -353,10 +353,12 @@ def raw_connection_do(sql)
353
353
case @connection_options [ :mode ]
354
354
when :dblib
355
355
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
+
360
362
result . do
361
363
end
362
364
ensure
You can’t perform that action at this time.
0 commit comments