rails-sqlserver / activerecord-sqlserver-adapter

SQL Server Adapter For Rails
MIT License
972 stars 558 forks source link

Add savepoint placeholder for each savepoint created #1179

Closed aidanharan closed 4 months ago

aidanharan commented 4 months ago

Fix DirtyTest#test_partial_update:

https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/actions/runs/9127055748/job/25096554308

DirtyTest#test_partial_update [/usr/local/bundle/bundler/gems/rails-fb4300ce193c/activerecord/test/cases/dirty_test.rb:365]:
5 instead of 6 queries were executed. Queries: SAVE TRANSACTION active_record_1

EXEC sp_executesql N'INSERT INTO [pirates] ([catchphrase], [parrot_id], [non_validated_parrot_id], [created_on], [updated_on]) OUTPUT INSERTED.[id] VALUES (@0, @1, @2, @3, @4)', N'@0 nvarchar(4000), @1 int, @2 int, @3 datetime2(6), @4 datetime2(6)', @0 = N'foo', @1 = NULL, @2 = NULL, @3 = '05-17-2024 10:53:27.262222', @4 = '05-17-2024 10:53:27.262222'

SAVE TRANSACTION active_record_1

EXEC sp_executesql N'UPDATE [pirates] SET [catchphrase] = @0, [parrot_id] = @1, [non_validated_parrot_id] = @2, [created_on] = @3, [updated_on] = @4 WHERE [pirates].[id] = @5; SELECT @@ROWCOUNT AS AffectedRows', N'@0 nvarchar(4000), @1 int, @2 int, @3 datetime2(6), @4 datetime2(6), @5 bigint', @0 = N'foo', @1 = NULL, @2 = NULL, @3 = '05-17-2024 10:53:27.262222', @4 = '05-17-2024 10:53:27.263973', @5 = 959118371

/* release savepoint placeholder for testing */.
Expected: 6
  Actual: 5