Colin Jack
unread,Dec 17, 2008, 9:29:37 PM12/17/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Oracle enhanced adapter for ActiveRecord
hello everybody, I'm bad in english.
oci8 support privilege, that can connect oracle as sysdba.
But Oracle enhanced adapter not surpport.
I hope Oracle enhanced adapter can surpport it too. Thank you.
Actually, supportion is simple.
first in class OCI8EnhancedAutoRecover
def initialize(config, factory =
OracleEnhancedConnectionFactory.new)
@active = true
@username, @password, @database, = config[:username].to_s, config
[:password].to_s, config[:database].to_s
@async = config[:allow_concurrency]
@prefetch_rows = config[:prefetch_rows] || 100
@cursor_sharing = config[:cursor_sharing] || 'similar'
@factory = factory
@privilege = config[:privilege] # add
@connection = @factory.new_connection @username, @password,
@database, @async, @prefetch_rows, @cursor_sharing, @privilege #
add
super @connection
end
second in class OracleEnhancedConnectionFactory
def new_connection(username, password, database, async,
prefetch_rows, cursor_sharing, privilege) #add
conn = OCI8.new username, password, database, privilege #add
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
last in class OCI8EnhancedAutoRecover
def reset!
logoff rescue nil
begin
@connection = @factory.new_connection @username, @password,
@database, @async, @prefetch_rows, @cursor_sharing, @privilege #add
__setobj__ @connection
@active = true
rescue
@active = false
raise
end
end