diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-13 07:36:52 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-13 07:36:52 +0000 |
commit | a303a168ac88d3c5e7a7e71a0c84ea3c2a44f972 (patch) | |
tree | cdd9f4d353f452328b7bfd3f4a03ba761682107d /activerecord/lib | |
parent | 45fd631e5e8ff45ed5fcec67905088b30fd2b297 (diff) | |
download | rails-a303a168ac88d3c5e7a7e71a0c84ea3c2a44f972.tar.gz rails-a303a168ac88d3c5e7a7e71a0c84ea3c2a44f972.tar.bz2 rails-a303a168ac88d3c5e7a7e71a0c84ea3c2a44f972.zip |
Oracle: to increase performance, prefetch 100 rows and enable similar cursor sharing. Both are configurable in database.yml. Closes #6607.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/oracle_adapter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb index b8d3ed5a95..2453781e53 100644 --- a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb @@ -552,12 +552,14 @@ begin # The OracleConnectionFactory factors out the code necessary to connect and # configure an Oracle/OCI connection. class OracleConnectionFactory #:nodoc: - def new_connection(username, password, database, async) + def new_connection(username, password, database, async, prefetch_rows, cursor_sharing) conn = OCI8.new username, password, database conn.exec %q{alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS'} conn.exec %q{alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS'} rescue nil conn.autocommit = true conn.non_blocking = true if async + conn.prefetch_rows = prefetch_rows + conn.exec "alter session set cursor_sharing = #{cursor_sharing}" rescue nil conn end end @@ -584,8 +586,10 @@ begin @active = true @username, @password, @database, = config[:username], config[:password], config[:database] @async = config[:allow_concurrency] + @prefetch_rows = config[:prefetch_rows] || 100 + @cursor_sharing = config[:cursor_sharing] || 'similar' @factory = factory - @connection = @factory.new_connection @username, @password, @database, @async + @connection = @factory.new_connection @username, @password, @database, @async, @prefetch_rows, @cursor_sharing super @connection end |