File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,25 @@ class OracleUnitTest < Test::Unit::TestCase
1616 assert_equal 'ferko_seq' , connection . default_sequence_name ( 'ferko' )
1717 assert_equal 'abcdefghi_abcdefghi_abcdef_seq' , connection . default_sequence_name ( 'abcdefghi_abcdefghi_abcdefghi_' )
1818 end
19-
19+
20+ test 'prefetch primary key if the table has one primary key' do
21+ connection = new_adapter_stub
22+
23+ assert connection . prefetch_primary_key?
24+
25+ connection . stubs ( :columns ) . returns ( [ stub ( :primary => true ) , stub ( :primary => false ) ] )
26+ assert connection . prefetch_primary_key? ( 'pages' )
27+ end
28+
29+ test 'do not prefetch primary key if the table has a composite primary key' do
30+ connection = new_adapter_stub
31+
32+ connection . stubs ( :columns ) . returns ( [ stub ( :primary => true ) , stub ( :primary => true ) , stub ( :primary => false ) ] )
33+ assert !connection . prefetch_primary_key? ( 'pages' )
34+ end
35+
2036 private
21-
37+
2238 def new_adapter_stub ( config = { } )
2339 config = config . merge ( { :adapter => 'oracle' , :adapter_spec => ArJdbc ::Oracle } )
2440 connection = stub ( 'connection' ) ; logger = nil
@@ -27,5 +43,5 @@ def new_adapter_stub(config = {})
2743 yield ( adapter ) if block_given?
2844 adapter
2945 end
30-
46+
3147end
You can’t perform that action at this time.
0 commit comments