File tree Expand file tree Collapse file tree 6 files changed +19
-1
lines changed
lib/active_record/connection_adapters/sqlserver Expand file tree Collapse file tree 6 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 11## v4.2.3
22
33* Fix SET defaults when using Azure.
4+ * Test insert 4-byte unicode chars.
5+ * Make rollback transaction transcount aware for implicit error rollbacks. Fixes #390
46
57
68## v4.2.2
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ def commit_db_transaction
6666 end
6767
6868 def rollback_db_transaction
69- do_execute 'ROLLBACK TRANSACTION'
69+ do_execute 'IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION'
7070 end
7171
7272 include Savepoints
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ def connection
3333 ActiveRecord ::Base . connection
3434 end
3535
36+ def with_use_output_inserted_disabled
37+ ActiveRecord ::ConnectionAdapters ::SQLServerAdapter . use_output_inserted = false
38+ yield
39+ ensure
40+ ActiveRecord ::ConnectionAdapters ::SQLServerAdapter . use_output_inserted = true
41+ end
42+
3643 end
3744end
3845
Original file line number Diff line number Diff line change 1+ # encoding: UTF-8
12require 'cases/helper_sqlserver'
23require 'models/ship'
34require 'models/developer'
Original file line number Diff line number Diff line change 1+ # encoding: UTF-8
12require 'cases/helper_sqlserver'
23
34class SQLServerUuidTest < ActiveRecord ::TestCase
@@ -10,6 +11,7 @@ class SQLServerUuidTest < ActiveRecord::TestCase
1011 end
1112
1213 it 'can create with a new pk' do
14+ # Type::Uuid::ACCEPTABLE_UUID
1315 obj = SSTestUuid . create!
1416 obj . id . must_be :present?
1517 obj . id . must_match acceptable_uuid
@@ -38,4 +40,9 @@ class SQLServerUuidTest < ActiveRecord::TestCase
3840 column . default_function . must_equal "newid()"
3941 end
4042
43+ it 'can insert even when use_output_inserted to false ' do
44+ obj = with_use_output_inserted_disabled { SSTestUuid . create! ( name : "😢" ) }
45+ obj . id . must_be :nil?
46+ end
47+
4148end
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ default_connection_info: &default_connection_info
1010 password : <%= ENV['ACTIVERECORD_UNITTEST_PASS'] || '' %>
1111 azure : <%= !ENV['ACTIVERECORD_UNITTEST_AZURE'].nil? %>
1212 collation : <%= ENV['ACTIVERECORD_UNITTEST_COLLATION'] || nil %>
13+ encoding : utf8
1314
1415connections :
1516
You can’t perform that action at this time.
0 commit comments