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

### Methods

connect dataset do execute schema_parse_table

### 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/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/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/adapters/oracle.rb, line 62
    62:       def execute(sql, opts={})
    63:         synchronize(opts[:server]) do |conn|
    64:           begin
    65:             r = log_yield(sql){conn.exec(sql)}
    66:             yield(r) if block_given?
    67:             r
    68:           rescue OCIException => e
    69:             raise_error(e, :disconnect=>CONNECTION_ERROR_CODES.include?(e.code))
    70:           end
    71:         end
    72:       end

schema_parse_table(table, opts={})

[Source]

        # File lib/sequel/adapters/oracle.rb, line 34
    34:       def schema_parse_table(table, opts={})
    35:         ds = dataset
    36:         ds.identifier_output_method = :downcase
    37:         schema_and_table = "#{"#{quote_identifier(opts[:schema])}." if opts[:schema]}#{quote_identifier(table)}"
    38:         table_schema = []
    39:         metadata = transaction(opts){|conn| conn.describe_table(schema_and_table)}
    40:         metadata.columns.each do |column|
    41:           table_schema << [
    42:             column.name.downcase.to_sym,
    43:             {
    44:               :type => column.data_type,
    45:               :db_type => column.type_string.split(' ')[0],
    46:               :type_string => column.type_string,
    47:               :charset_form => column.charset_form,
    48:               :char_used => column.char_used?,
    49:               :char_size => column.char_size,
    50:               :data_size => column.data_size,
    51:               :precision => column.precision,
    52:               :scale => column.scale,
    53:               :fsprecision => column.fsprecision,
    54:               :lfprecision => column.lfprecision,
    55:               :allow_null => column.nullable?
    56:             }
    57:           ]
    58:         end
    59:         table_schema
    60:       end

[Validate]