private void findUniqueIndexes(DatabaseMetaData md,String schemaName,String tableName,Map<String,Column> cm,Table table) throws SQLException {
  try {
    ResultSet rsi=getIndexResultSet(md,schemaName,tableName,true);
    if (rsi.isBeforeFirst()) {
      String lastIdxName=null;
      Key uIdx=null;
      while (rsi.next()) {
        short idxType=rsi.getShort("TYPE");
        if (idxType != DatabaseMetaData.tableIndexStatistic) {
          String idxName=rsi.getString("INDEX_NAME");
          if (!idxName.equals(lastIdxName)) {
            if (uIdx != null)             table.AddKey(uIdx);
            uIdx=new Key(Key.Unique);
            uIdx.setName(idxName);
            lastIdxName=idxName;
          }
          String colName=rsi.getString("COLUMN_NAME");
          Column column=cm.get(colName);
          uIdx.AddColumn(column);
        }
      }
      if (uIdx != null)       table.AddKey(uIdx);
    }
    rsi.close();
  }
 catch (  UnsupportedOperationException e) {
    if (logger.isDebugEnabled())     logger.debug("Can't search for unique indexes, because this function is unsupported: " + e);
  }
}

private void findUniqueIndexes ( DatabaseMetaData md , String schemaName , String tableName , Map < String , Column > cm , Table table ) throws SQLException { try { ResultSet rsi = getIndexResultSet ( md , schemaName , tableName , true ) ; if ( rsi . isBeforeFirst ( ) ) { String lastIdxName = null ; Key uIdx = null ; while ( rsi . next ( ) ) { short idxType = rsi . getShort ( "TYPE" ) ; if ( idxType != DatabaseMetaData . tableIndexStatistic ) { String idxName = rsi . getString ( "INDEX_NAME" ) ; if ( ! idxName . equals ( lastIdxName ) ) { if ( uIdx != null ) table . AddKey ( uIdx ) ; uIdx = new Key ( Key . Unique ) ; uIdx . setName ( idxName ) ; lastIdxName = idxName ; } String colName = rsi . getString ( "COLUMN_NAME" ) ; Column column = cm . get ( colName ) ; uIdx . AddColumn ( column ) ; } } if ( uIdx != null ) table . AddKey ( uIdx ) ; } rsi . close ( ) ; } catch ( UnsupportedOperationException e ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Can't search for unique indexes, because this function is unsupported: " + e ) ; } }
finds unique indexes from the metadata and adds them to the table . primary key is included too , if it exists .
