Skip to content

Commit 8406db2

Browse files
authored
Merge pull request #818 from aidanharan/tsql-db-send-failed
WIP: Rails 6: Handle false return by TinyTDS if connection fails and fixed CI
2 parents abba3c8 + 7719b0d commit 8406db2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

appveyor.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ clone_depth: 5
44
build: off
55
matrix:
66
fast_finish: true
7-
7+
allow_failures:
8+
- ruby_version: "25"
9+
- ruby_version: "26"
10+
- ruby_version: "27"
11+
- ruby_version: "27-x64"
812
services:
913
- mssql2014
1014

lib/active_record/connection_adapters/sqlserver/database_statements.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,12 @@ def sp_executesql_sql(sql, types, params, name)
352352
def raw_connection_do(sql)
353353
case @connection_options[:mode]
354354
when :dblib
355-
@connection.execute(sql).do
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
360+
result.do
356361
end
357362
ensure
358363
@update_sql = false

0 commit comments

Comments
 (0)