class Scenic::Adapters::Oracle::Indexes
Attributes
connection[R]
Public Class Methods
new(connection:)
click to toggle source
# File lib/scenic/adapters/oracle/indexes.rb, line 9 def initialize(connection:) @connection = connection end
Public Instance Methods
on(name)
click to toggle source
# File lib/scenic/adapters/oracle/indexes.rb, line 13 def on(name) indexes_on(name).map(&method(:index_from_database)) end
Private Instance Methods
index_columns(index_name)
click to toggle source
# File lib/scenic/adapters/oracle/indexes.rb, line 33 def index_columns(index_name) connection.select_values(<<-EOSQL) select lower(column_name) from user_ind_columns where index_name = upper('#{index_name}') order by column_position EOSQL end
index_from_database(result)
click to toggle source
# File lib/scenic/adapters/oracle/indexes.rb, line 42 def index_from_database(result) Scenic::Adapters::Oracle::Index.new( object_name: result["object_name"], index_name: result["index_name"], columns: index_columns(result["index_name"]), definition: result["definition"] ) end
indexes_on(name)
click to toggle source
# File lib/scenic/adapters/oracle/indexes.rb, line 22 def indexes_on(name) connection.select_all(<<-EOSQL) select table_name as object_name, index_name, dbms_metadata.get_ddl('INDEX', index_name, table_owner) as definition from user_indexes where table_name = upper('#{name}') EOSQL end