Methods
Public Instance
Included modules
Constants
CONNECTION_ERROR_CODES | = | [ 28, 1012, 2396, 3113, 3114, 3135 ].freeze |
ORA-00028: your session has been killed ORA-01012: not logged on ORA-02396: exceeded maximum idle time, please connect again ORA-03113: end-of-file on communication channel ORA-03114: not connected to ORACLE ORA-03135: connection lost contact |
|
ORACLE_TYPES | = | { :blob=>lambda{|b| Sequel::SQL::Blob.new(b.read)}, :clob=>:read.to_proc }.freeze | ||
PS_TYPES | = | {'string'=>String, 'integer'=>Integer, 'float'=>Float, 'decimal'=>Float, 'date'=>Time, 'datetime'=>Time, 'time'=>Time, 'boolean'=>String, 'blob'=>OCI8::BLOB, 'clob'=>OCI8::CLOB}.freeze |
Attributes
conversion_procs | [R] |
Hash of conversion procs for this database. |
Public Instance methods
connect(server)
[show source]
# File lib/sequel/adapters/oracle.rb 28 def connect(server) 29 opts = server_opts(server) 30 if opts[:database] 31 dbname = opts[:host] ? \ 32 "//#{opts[:host]}#{":#{opts[:port]}" if opts[:port]}/#{opts[:database]}" : opts[:database] 33 else 34 dbname = opts[:host] 35 end 36 conn = OCI8.new(opts[:user], opts[:password], dbname, opts[:privilege]) 37 if prefetch_rows = opts.fetch(:prefetch_rows, 100) 38 conn.prefetch_rows = typecast_value_integer(prefetch_rows) 39 end 40 conn.autocommit = true 41 conn.non_blocking = true 42 43 # The ruby-oci8 gem which retrieves oracle columns with a type of 44 # DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE is complex based on the 45 # ruby version and Oracle version (9 or later) 46 # In the now standard case of Oracle 9 or later, the timezone 47 # is determined by the Oracle session timezone. Thus if the user 48 # requests Sequel provide UTC timezone to the application, 49 # we need to alter the session timezone to be UTC 50 if Sequel.application_timezone == :utc 51 conn.exec("ALTER SESSION SET TIME_ZONE='-00:00'") 52 end 53 54 class << conn 55 attr_reader :prepared_statements 56 end 57 conn.instance_variable_set(:@prepared_statements, {}) 58 59 conn 60 end
disconnect_connection(c)
[show source]
# File lib/sequel/adapters/oracle.rb 62 def disconnect_connection(c) 63 c.logoff 64 rescue OCIException 65 nil 66 end
execute(sql, opts=OPTS, &block)
[show source]
# File lib/sequel/adapters/oracle.rb 68 def execute(sql, opts=OPTS, &block) 69 _execute(nil, sql, opts, &block) 70 end
execute_insert(sql, opts=OPTS)
[show source]
# File lib/sequel/adapters/oracle.rb 72 def execute_insert(sql, opts=OPTS) 73 _execute(:insert, sql, opts) 74 end
freeze()
[show source]
# File lib/sequel/adapters/oracle.rb 76 def freeze 77 @conversion_procs.freeze 78 super 79 end