Skip to content

Commit 8d713fb

Browse files
committed
Use proper "REPEATABLE READ" in DB statements.
1 parent 74f984a commit 8d713fb

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/active_record/connection_adapters/sqlserver/database_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def user_options_isolation_level
157157
WHEN 0 THEN NULL
158158
WHEN 1 THEN 'READ UNCOMITTED'
159159
WHEN 2 THEN 'READ COMITTED'
160-
WHEN 3 THEN 'REPEATABLE'
160+
WHEN 3 THEN 'REPEATABLE READ'
161161
WHEN 4 THEN 'SERIALIZABLE'
162162
WHEN 5 THEN 'SNAPSHOT' END AS [isolation_level]
163163
FROM [sys].[dm_exec_sessions]

test/cases/adapter_test_sqlserver.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -522,18 +522,18 @@ def setup
522522
context "finding out what user_options are available" do
523523

524524
should "run the database consistency checker useroptions command" do
525-
@connection.expects(:select_rows).with(regexp_matches(/^dbcc\s+useroptions$/i), 'SCHEMA').returns []
526-
@connection.user_options
525+
keys = [:textsize, :language, :isolation_level, :dateformat]
526+
user_options = @connection.user_options
527+
keys.each do |key|
528+
msg = "Expected key:#{key} in user_options:#{user_options.inspect}"
529+
assert user_options.key?(key), msg
530+
end
527531
end
528532

529533
should "return a underscored key hash with indifferent access of the results" do
530-
@connection.expects(:select_rows).with(regexp_matches(/^dbcc\s+useroptions$/i), 'SCHEMA').returns [['some', 'thing'], ['isolation level', 'read uncommitted']]
531-
uo = @connection.user_options
532-
assert_equal 2, uo.keys.size
533-
assert_equal 'thing', uo['some']
534-
assert_equal 'thing', uo[:some]
535-
assert_equal 'read uncommitted', uo['isolation_level']
536-
assert_equal 'read uncommitted', uo[:isolation_level]
534+
user_options = @connection.user_options
535+
assert_equal 'read committed', user_options['isolation_level']
536+
assert_equal 'read committed', user_options[:isolation_level]
537537
end
538538

539539
end unless sqlserver_azure?

0 commit comments

Comments
 (0)