Class Sequel::Oracle::Database
In: lib/sequel/adapters/oracle.rb
Parent: Sequel::Database

Methods

Included Modules

DatabaseMethods

Constants

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{|b| b.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}

Attributes

conversion_procs  [R]  Hash of conversion procs for this database.

Public Instance methods

[Source]

    # File lib/sequel/adapters/oracle.rb, line 24
24:       def connect(server)
25:         opts = server_opts(server)
26:         if opts[:database]
27:           dbname = opts[:host] ? \
28:             "//#{opts[:host]}#{":#{opts[:port]}" if opts[:port]}/#{opts[:database]}" : opts[:database]
29:         else
30:           dbname = opts[:host]
31:         end
32:         conn = OCI8.new(opts[:user], opts[:password], dbname, opts[:privilege])
33:         if prefetch_rows = opts.fetch(:prefetch_rows, 100)
34:           conn.prefetch_rows = typecast_value_integer(prefetch_rows)
35:         end
36:         conn.autocommit = true
37:         conn.non_blocking = true
38:         
39:         # The ruby-oci8 gem which retrieves oracle columns with a type of
40:         # DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE is complex based on the
41:         # ruby version (1.9.2 or later) and Oracle version (9 or later)
42:         # In the now standard case of 1.9.2 and Oracle 9 or later, the timezone
43:         # is determined by the Oracle session timezone. Thus if the user
44:         # requests Sequel provide UTC timezone to the application,
45:         # we need to alter the session timezone to be UTC
46:         if Sequel.application_timezone == :utc
47:           conn.exec("ALTER SESSION SET TIME_ZONE='-00:00'")
48:         end
49:         
50:         class << conn
51:           attr_reader :prepared_statements
52:         end
53:         conn.instance_variable_set(:@prepared_statements, {})
54:         
55:         conn
56:       end

[Source]

    # File lib/sequel/adapters/oracle.rb, line 58
58:       def disconnect_connection(c)
59:         c.logoff
60:       rescue OCIInvalidHandle
61:         nil
62:       end

[Source]

    # File lib/sequel/adapters/oracle.rb, line 64
64:       def execute(sql, opts=OPTS, &block)
65:         _execute(nil, sql, opts, &block)
66:       end

[Source]

    # File lib/sequel/adapters/oracle.rb, line 68
68:       def execute_insert(sql, opts=OPTS)
69:         _execute(:insert, sql, opts)
70:       end

[Validate]