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