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 ].freeze   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=>:read.to_proc
PS_TYPES = {'string'=>String, 'integer'=>Integer, 'float'=>Float, 'decimal'=>Float, 'date'=>Time, 'datetime'=>Time, 'time'=>Time, 'boolean'=>String, 'blob'=>OCI8::BLOB}.freeze

Attributes

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

Public Instance methods

[Source]

    # 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 and Oracle version (9 or later)
44:         # In the now standard case of 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

[Source]

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

[Source]

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

[Source]

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

[Source]

    # File lib/sequel/adapters/oracle.rb, line 74
74:       def freeze
75:         @conversion_procs.freeze
76:         super
77:       end

[Validate]