Method: Sequel::JDBC::Database#indexes
- Defined in:
- lib/sequel/adapters/jdbc.rb
#indexes(table, opts = OPTS) ⇒ Object
Use the JDBC metadata to get the index information for the table.
338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/sequel/adapters/jdbc.rb', line 338 def indexes(table, opts=OPTS) m = output_identifier_meth schema, table = (table, opts) indexes = {} (:getIndexInfo, nil, schema, table, false, true) do |r| next unless name = r[:column_name] next if respond_to?(:primary_key_index_re, true) and r[:index_name] =~ primary_key_index_re i = indexes[m.call(r[:index_name])] ||= {:columns=>[], :unique=>[false, 0].include?(r[:non_unique])} i[:columns] << m.call(name) end indexes end |