Class: Sequel::Oracle::Database

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

### Methods

connect dataset do execute transaction

### 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

### Public Instance methods

connect(server)

[Source]

        # File lib/sequel_core/adapters/oracle.rb, line 16
    16:       def connect(server)
    17:         opts = server_opts(server)
    18:         if opts[:database]
    19:           dbname = opts[:host] ? \
    20:             "//#{opts[:host]}#{":#{opts[:port]}" if opts[:port]}/#{opts[:database]}" : opts[:database]
    21:         else
    22:           dbname = opts[:host]
    23:         end
    24:         conn = OCI8.new(opts[:user], opts[:password], dbname, opts[:privilege])
    25:         conn.autocommit = true
    26:         conn.non_blocking = true
    27:         conn
    28:       end

dataset(opts = nil)

[Source]

        # File lib/sequel_core/adapters/oracle.rb, line 30
    30:       def dataset(opts = nil)
    31:         Oracle::Dataset.new(self, opts)
    32:       end

do(sql, opts={})

Alias for execute

execute(sql, opts={}) {|r| ...}

[Source]

        # File lib/sequel_core/adapters/oracle.rb, line 34
    34:       def execute(sql, opts={})
    35:         log_info(sql)
    36:         synchronize(opts[:server]) do |conn|
    37:           begin
    38:             r = conn.exec(sql)
    39:             yield(r) if block_given?
    40:             r
    41:           rescue OCIException => e
    42:             if CONNECTION_ERROR_CODES.include?(e.code)
    43:               raise(Sequel::DatabaseDisconnectError)
    44:             else
    45:               raise
    46:             end
    47:           end
    48:         end
    49:       end

transaction(server=nil) {|conn| ...}

[Source]

        # File lib/sequel_core/adapters/oracle.rb, line 52
    52:       def transaction(server=nil)
    53:         synchronize(server) do |conn|
    54:           return yield(conn) if @transactions.include?(Thread.current)
    55:
    56:           conn.autocommit = false
    57:           begin
    58:             @transactions << Thread.current
    59:             yield(conn)
    60:           rescue => e
    61:             conn.rollback
    62:             raise e unless Error::Rollback === e
    63:           ensure
    64:             conn.commit unless e
    65:             conn.autocommit = true
    66:             @transactions.delete(Thread.current)
    67:           end
    68:         end
    69:       end

[Validate]