use of net.sourceforge.squirrel_sql.fw.sql.IndexInfo in project tdq-studio-se by Talend.
the class IndexesTab method getDataSet.
public DataSet getDataSet() throws Exception {
INode node = getNode();
if (node == null) {
return null;
}
if (node instanceof TableNode) {
TableNode tableNode = (TableNode) node;
List<IndexInfo> indexes = node.getSession().getMetaData().getIndexInfo(tableNode.getTableInfo());
List<Comparable[]> dataRows = new ArrayList<Comparable[]>();
int index = 0;
for (IndexInfo col : indexes) {
// type)
if ("STATISTIC".equalsIgnoreCase(col.getIndexType().name())) {
continue;
}
Comparable[] row = new Comparable[COLUMN_LABELS.length];
dataRows.add(row);
int i = 0;
row[i++] = col.isNonUnique();
row[i++] = col.getIndexQualifier();
row[i++] = col.getSimpleName();
row[i++] = col.getIndexType();
row[i++] = col.getOrdinalPosition();
row[i++] = col.getColumnName();
row[i++] = col.getSortOrder();
row[i++] = col.getCardinality();
row[i++] = col.getPages();
row[i++] = col.getFilterCondition();
if (i != COLUMN_LABELS.length)
throw new RuntimeException(Messages.getString("ColumnInfoTab.runtimeException"));
}
DataSet dataSet = new DataSet(COLUMN_LABELS, dataRows.toArray(new Comparable[dataRows.size()][]));
return dataSet;
}
return null;
}
use of net.sourceforge.squirrel_sql.fw.sql.IndexInfo in project tdq-studio-se by Talend.
the class IndexNode method loadChildren.
/*
* (non-Javadoc)
*
* @see net.sourceforge.sqlexplorer.dbstructure.nodes.AbstractNode#loadChildren()
*/
public void loadChildren() {
try {
List<IndexInfo> infos = _session.getMetaData().getIndexInfo(_parentTable.getTableInfo());
for (IndexInfo info : infos) {
String indexName = info.getSimpleName();
SortOrder sort = info.getSortOrder();
if (indexName != null && indexName.equalsIgnoreCase(_name)) {
ColumnNode col = new ColumnNode(this, info.getColumnName(), _session, _parentTable, true);
if (sort == null || sort == SortOrder.ASC) {
col.setLabelDecoration("ASC");
} else {
col.setLabelDecoration("DESC");
}
addChildNode(col);
}
}
} catch (Exception e) {
SQLExplorerPlugin.error("Could not load column names", e);
}
}
Aggregations