final List<IndexColumn> thatColumns = that.getColumns(); if (isUnique != that.isUnique()) compareTo = indexType.ordinal() - that.getIndexType().ordinal();
jsonIndex.put("name", index.getName()); jsonIndex.put("name", index.getName()); final IndexType indexType = index.getIndexType(); if (indexType != IndexType.unknown && indexType != IndexType.other) jsonIndex.put("unique", index.isUnique());
private Set<Column> listTableKeys(final Table table) { final Set<Column> tableKeys = new HashSet<>(); final PrimaryKey primaryKey = table.getPrimaryKey(); if (primaryKey != null && primaryKey.getColumns().size() == 1) { tableKeys.add(primaryKey.getColumns().get(0)); } for (final Index index: table.getIndexes()) { if (index != null && index.isUnique() && index.getColumns().size() == 1) { tableKeys.add(index.getColumns().get(0)); } } return tableKeys; }
if (!options.isHideIndexNames()) indexName = index.getName(); final IndexType indexType = index.getIndexType(); String indexTypeString = ""; if (indexType != IndexType.unknown && indexType != IndexType.other) final String indexDetails = "[" + (index.isUnique()? "": "non-") + "unique " + indexTypeString + "index]"; out.println(formattingHelper.createNameRow(indexName, indexDetails)); printTableColumns(index.getColumns()); if (index.hasDefinition()) .getDefinition()));
private static Collection<List<String>> indexCoumnNames(final Table table, final boolean includeUniqueOnly) { final List<List<String>> allIndexCoumns = new ArrayList<>(); if (table instanceof PartialDatabaseObject) { return allIndexCoumns; } final PrimaryKey primaryKey = table.getPrimaryKey(); final List<String> pkColumns = columnNames(primaryKey); allIndexCoumns.add(pkColumns); for (final Index index: table.getIndexes()) { if (includeUniqueOnly && !index.isUnique()) { continue; } final List<String> indexColumns = columnNames(index); allIndexCoumns.add(indexColumns); } return allIndexCoumns; }
private void printPrimaryKey(final Index primaryKey) { if (primaryKey != null) { final String name = primaryKey.getName(); out.println(formattingHelper.createEmptyRow()); String pkName = ""; if (!options.isHidePrimaryKeyNames()) { pkName = name; } if (Utility.isBlank(pkName)) { pkName = ""; } out.println(formattingHelper.createNameRow(pkName, "[primary key]")); printTableColumns(primaryKey.getColumns()); } }
private void printPrimaryKey(final Index primaryKey) { if (primaryKey != null) { formattingHelper.writeEmptyRow(); formattingHelper.writeWideRow("Primary Key", "section"); formattingHelper.writeEmptyRow(); final String name = identifiers.quoteName(primaryKey); String pkName = ""; if (!options.isHidePrimaryKeyNames()) { pkName = name; } if (isBlank(pkName)) { pkName = ""; } formattingHelper.writeNameRow(pkName, "[primary key]"); printRemarks(primaryKey); printTableColumns(primaryKey.getColumns(), false); printDependantObjectDefinition(primaryKey); } }
+ " sorted for table " + table, expectedValues[i], equalTo(index.getName()));
@Override public DaIndexType getIndexType() { if ((this.extraIndexInfo != null && this.extraIndexInfo.isClustered()) || this.index.getIndexType() == IndexType .clustered) { return DaIndexType.CLUSTERED; } else { switch (this.index.getIndexType()) { case clustered: return DaIndexType.CLUSTERED; default: return DaIndexType.OTHER; } } }
@Override public DaTable getParent() { return new DaTableImpl(index.getParent(), schemaStrategy); }
jsonIndex.put("name", index.getName()); jsonIndex.put("name", index.getName()); final IndexType indexType = index.getIndexType(); if (indexType != IndexType.unknown && indexType != IndexType.other) jsonIndex.put("unique", index.isUnique()); for (final IndexColumn indexColumn: index.getColumns()) if (index.hasDefinition()) jsonIndex.put("definition", index.getDefinition());
private Set<Column> listTableKeys(final Table table) { final Set<Column> tableKeys = new HashSet<>(); final PrimaryKey primaryKey = table.getPrimaryKey(); if (primaryKey != null && primaryKey.getColumns().size() == 1) { tableKeys.add(primaryKey.getColumns().get(0)); } for (final Index index: table.getIndexes()) { if (index != null && index.isUnique() && index.getColumns().size() == 1) { tableKeys.add(index.getColumns().get(0)); } } return tableKeys; }
private static Collection<List<String>> indexCoumnNames(final Table table, final boolean includeUniqueOnly) { final List<List<String>> allIndexCoumns = new ArrayList<>(); if (table instanceof PartialDatabaseObject) { return allIndexCoumns; } final PrimaryKey primaryKey = table.getPrimaryKey(); final List<String> pkColumns = columnNames(primaryKey); allIndexCoumns.add(pkColumns); for (final Index index: table.getIndexes()) { if (includeUniqueOnly && !index.isUnique()) { continue; } final List<String> indexColumns = columnNames(index); allIndexCoumns.add(indexColumns); } return allIndexCoumns; }
public static final List<String> columnNames(final Index index) { if (index == null) { return Collections.emptyList(); } final List<String> columnNames = new ArrayList<>(); for (final IndexColumn indexColumn: index.getColumns()) { columnNames.add(indexColumn.getFullName()); } return columnNames; }
@Override public String getName() { return index.getName(); }
final List<IndexColumn> thatColumns = that.getColumns(); if (isUnique != that.isUnique()) compareTo = indexType.ordinal() - that.getIndexType().ordinal();
jsonIndex.put("name", index.getName()); jsonIndex.put("name", index.getName()); final IndexType indexType = index.getIndexType(); if (indexType != IndexType.unknown && indexType != IndexType.other) jsonIndex.put("unique", index.isUnique());
private Set<Column> listTableKeys(final Table table) { final Set<Column> tableKeys = new HashSet<>(); final PrimaryKey primaryKey = table.getPrimaryKey(); if (primaryKey != null && primaryKey.getColumns().size() == 1) { tableKeys.add(primaryKey.getColumns().get(0)); } for (final Index index: table.getIndexes()) { if (index != null && index.isUnique() && index.getColumns().size() == 1) { tableKeys.add(index.getColumns().get(0)); } } return tableKeys; }
@Override public boolean isUnique() { return index.isUnique(); }
@Override public ImmutableList<DaColumn> getColumns() { try { return ListAdapter.adapt(index.getColumns()) .collect(new Function<IndexColumn, DaColumn>() { @Override public DaColumn valueOf(IndexColumn object) { return new DaColumnImpl(object, schemaStrategy); } }) .toImmutable(); } catch (NullPointerException exc) { throw exc; } }