Skip to content

Commit 17d0b78

Browse files
committed
Update database_statements.rb
1 parent 8b3c4e5 commit 17d0b78

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/active_record/connection_adapters/sqlserver/database_statements.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notif
2727

2828
verified!
2929

30+
# binding.pry if $DEBUG
31+
3032
notification_payload[:affected_rows] = affected_rows(result)
3133
notification_payload[:row_count] = result.count
3234
result
@@ -41,6 +43,9 @@ def cast_result(raw_result)
4143
end
4244

4345
def affected_rows(raw_result)
46+
47+
# raw_result.first['AffectedRows']
48+
4449
raw_result&.first&.fetch('AffectedRows', 0) || 0
4550
end
4651

@@ -70,10 +75,10 @@ def exec_update(sql, name = nil, binds = [])
7075
super(sql, name, binds)
7176
end
7277

73-
def exec_insert_all(sql, name)
74-
sql = sql.dup << "; SELECT @@ROWCOUNT AS AffectedRows"
75-
super(sql, name)
76-
end
78+
# def exec_insert_all(sql, name)
79+
# sql = sql.dup << "; SELECT @@ROWCOUNT AS AffectedRows"
80+
# super(sql, name)
81+
# end
7782

7883
def begin_db_transaction
7984
internal_execute("BEGIN TRANSACTION", "TRANSACTION", allow_retry: true, materialize_transactions: false)

0 commit comments

Comments
 (0)