lib/active_record/connection_adapters/fdbsql/schema_statements.rb
def indexes(table_name, name = nil)
          select_rows(
            "SELECT index_name, "+
            "       is_unique "+
            "FROM information_schema.indexes "+
            "WHERE table_schema = CURRENT_SCHEMA "+
            "  AND table_name = '#{quote_string(table_name.to_s)}' "+
            "  AND index_type <> 'PRIMARY' "+
            "ORDER BY index_name",
            name || SCHEMA_LOG_NAME
          ).map { |row|
            cols = select_rows(
              "SELECT column_name "+
              "FROM information_schema.index_columns "+
              "WHERE index_table_schema = CURRENT_SCHEMA "+
              "  AND index_table_name = '#{quote_string(table_name.to_s)}' "+
              "  AND index_name = '#{quote_string(row[0])}' "+
              "ORDER BY ordinal_position",
              name || SCHEMA_LOG_NAME
            ).map { |col_row|
              col_row[0]
            }
            IndexDefinition.new(table_name, row[0], row[1] == 'YES', cols, [], {})
          }
        end
# Returns an array of indexes for the given table.
Returns an array of indexes for the given table.
Returns an array of indexes for the given table .
def indexes(table_name, name = nil)
          select_rows(
            "SELECT index_name, "+
            "       is_unique "+
            "FROM information_schema.indexes "+
            "WHERE table_schema = CURRENT_SCHEMA "+
            "  AND table_name = '#{quote_string(table_name.to_s)}' "+
            "  AND index_type <> 'PRIMARY' "+
            "ORDER BY index_name",
            name || SCHEMA_LOG_NAME
          ).map { |row|
            cols = select_rows(
              "SELECT column_name "+
              "FROM information_schema.index_columns "+
              "WHERE index_table_schema = CURRENT_SCHEMA "+
              "  AND index_table_name = '#{quote_string(table_name.to_s)}' "+
              "  AND index_name = '#{quote_string(row[0])}' "+
              "ORDER BY ordinal_position",
              name || SCHEMA_LOG_NAME
            ).map { |col_row|
              col_row[0]
            }
            IndexDefinition.new(table_name, row[0], row[1] == 'YES', cols, [], {})
          }
        end
def indexes ( table_name , name = nil ) select_rows ( "SELECT index_name, " + "       is_unique " + "FROM information_schema.indexes " + "WHERE table_schema = CURRENT_SCHEMA " + "  AND table_name = '#{quote_string(table_name.to_s)}' " + "  AND index_type <> 'PRIMARY' " + "ORDER BY index_name" , name || SCHEMA_LOG_NAME ) . map { | row | cols = select_rows ( "SELECT column_name " + "FROM information_schema.index_columns " + "WHERE index_table_schema = CURRENT_SCHEMA " + "  AND index_table_name = '#{quote_string(table_name.to_s)}' " + "  AND index_name = '#{quote_string(row[0])}' " + "ORDER BY ordinal_position" , name || SCHEMA_LOG_NAME ) . map { | col_row | col_row [ 0 ] } IndexDefinition . new ( table_name , row [ 0 ] , row [ 1 ] == 'YES' , cols , [ ] , { } ) } end
Returns an array of indexes for the given table.
Returns an array of indexes for the given table .
table_name
name