Skip to content

Commit 863da47

Browse files
committed
Use cursor_sharing = force by default again
it actually reverts rsim#1503 rsim#1498 implemented prepared statements for dictionary queries. However rsim#1713 restored non-prepared statements for `column_definitions` and `pk_and_sequence_for`, which likely have caused longer elapsed time for these queries reported at rsim#1720 Those who needs 'cursor_sharing = exact' can specify its own value to .database.yml
1 parent b43503b commit 863da47

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def new_connection(config)
150150
# @raw_connection.setDefaultRowPrefetch(prefetch_rows) if prefetch_rows
151151
end
152152

153-
cursor_sharing = config[:cursor_sharing]
153+
cursor_sharing = config[:cursor_sharing] || "force"
154154
exec "alter session set cursor_sharing = #{cursor_sharing}" if cursor_sharing
155155

156156
# Initialize NLS parameters

lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def self.new_connection(config)
295295
privilege = config[:privilege] && config[:privilege].to_sym
296296
async = config[:allow_concurrency]
297297
prefetch_rows = config[:prefetch_rows] || 100
298-
cursor_sharing = config[:cursor_sharing]
298+
cursor_sharing = config[:cursor_sharing] || "force"
299299
# get session time_zone from configuration or from TZ environment variable
300300
time_zone = config[:time_zone] || ENV["TZ"]
301301

spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
expect(ActiveRecord::Base.connection).to be_active
3232
end
3333

34-
it "should use database default cursor_sharing parameter value exact by default" do
34+
it "should use database default cursor_sharing parameter value force by default" do
3535
# Use `SYSTEM_CONNECTION_PARAMS` to query v$parameter
3636
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS)
37-
expect(ActiveRecord::Base.connection.select_value("select value from v$parameter where name = 'cursor_sharing'")).to eq("EXACT")
37+
expect(ActiveRecord::Base.connection.select_value("select value from v$parameter where name = 'cursor_sharing'")).to eq("FORCE")
3838
end
3939

40-
it "should use modified cursor_sharing value force" do
41-
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS.merge(cursor_sharing: :force))
42-
expect(ActiveRecord::Base.connection.select_value("select value from v$parameter where name = 'cursor_sharing'")).to eq("FORCE")
40+
it "should use modified cursor_sharing value exact" do
41+
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS.merge(cursor_sharing: :exact))
42+
expect(ActiveRecord::Base.connection.select_value("select value from v$parameter where name = 'cursor_sharing'")).to eq("EXACT")
4343
end
4444
end
4545

0 commit comments

Comments
 (0)