lib/arjdbc/teradata/adapter.rb
def indexes(table_name, name = nil, schema_name = nil)
      return false unless table_name
      schema, table = extract_schema_and_table(table_name.to_s)
      return false unless table

      schema = database_name unless schema

      result = select_rows('SELECT DatabaseName, TableName, ColumnName, IndexType, IndexName, UniqueFlag' <<
                           ' FROM DBC.Indices' <<
                           " WHERE TableName (NOT CS) = '#{table}' (NOT CS)" <<
                           " AND DatabaseName (NOT CS) = '#{schema}' (NOT CS)")

      result.map do |row|
        idx_table_name = row[1].to_s.strip
        idx_column_name = row[2].to_s.strip
        idx_index_name = row[4].to_s.strip
        idx_unique_flag = row[5].to_s.strip

        columns = []
        columns << idx_column_name

        IndexDefinition.new(idx_table_name, idx_index_name, (idx_unique_flag == 'Y'), columns)
      end
    end
def indexes(table_name, name = nil, schema_name = nil)
      return false unless table_name
      schema, table = extract_schema_and_table(table_name.to_s)
      return false unless table

      schema = database_name unless schema

      result = select_rows('SELECT DatabaseName, TableName, ColumnName, IndexType, IndexName, UniqueFlag' <<
                           ' FROM DBC.Indices' <<
                           " WHERE TableName (NOT CS) = '#{table}' (NOT CS)" <<
                           " AND DatabaseName (NOT CS) = '#{schema}' (NOT CS)")

      result.map do |row|
        idx_table_name = row[1].to_s.strip
        idx_column_name = row[2].to_s.strip
        idx_index_name = row[4].to_s.strip
        idx_unique_flag = row[5].to_s.strip

        columns = []
        columns << idx_column_name

        IndexDefinition.new(idx_table_name, idx_index_name, (idx_unique_flag == 'Y'), columns)
      end
    end
def indexes ( table_name , name = nil , schema_name = nil ) return false unless table_name schema , table = extract_schema_and_table ( table_name . to_s ) return false unless table schema = database_name unless schema result = select_rows ( 'SELECT DatabaseName, TableName, ColumnName, IndexType, IndexName, UniqueFlag' << ' FROM DBC.Indices' << " WHERE TableName (NOT CS) = '#{table}' (NOT CS)" << " AND DatabaseName (NOT CS) = '#{schema}' (NOT CS)" ) result . map do | row | idx_table_name = row [ 1 ] . to_s . strip idx_column_name = row [ 2 ] . to_s . strip idx_index_name = row [ 4 ] . to_s . strip idx_unique_flag = row [ 5 ] . to_s . strip columns = [ ] columns << idx_column_name IndexDefinition . new ( idx_table_name , idx_index_name , ( idx_unique_flag == 'Y' ) , columns ) end end
:nodoc:
: nodoc :