class DBI::DBD::OCI8::Database

def columns(table)

SQLs are copied from DBD::Oracle.
def columns(table)
  tab = @handle.describe_table(table)
  cols = tab.columns
  cols.collect! do |col|
    column_metadata_to_column_info(col)
  end
  dbh = DBI::DatabaseHandle.new(self)
  primaries = {}
  dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name) do |row|
lect column_name
from all_cons_columns a, all_constraints b
here a.owner = b.owner
 and a.constraint_name = b.constraint_name
 and a.table_name = b.table_name
 and b.constraint_type = 'P'
 and b.owner = :1
 and b.table_name = :2
S
    primaries[row[0]] = true
  end
  indices = {}
  uniques = {}
  dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name) do |row|
lect a.column_name, a.index_name, b.uniqueness
from all_ind_columns a, all_indexes b
here a.index_name = b.index_name
 and a.index_owner = b.owner
 and a.table_owner = :1
 and a.table_name = :2
S
    col_name, index_name, uniqueness = row
    indices[col_name] = true
    uniques[col_name] = true if uniqueness == 'UNIQUE'
  end
  dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name).collect do |row|
lect column_id, column_name, data_default
from all_tab_columns
here owner = :1
 and table_name = :2
S
    col_id, col_name, default = row
    col = cols[col_id.to_i - 1]
    col_name = col['name']
    if default && default[0] == ?'
      default = default[1..-2].gsub(/''/, "'")
    end
    col['indexed']   = indices[col_name]   || false
    col['primary']   = primaries[col_name] || false
    col['unique']    = uniques[col_name]   || false
    col['default']   = default
    col
  end
rescue OCIException => err
  raise_dbierror(err)
end