use of org.jkiss.dbeaver.ext.exasol.model.ExasolTableIndexColumn in project dbeaver by serge-rider.
the class ExasolTableIndexCache method fetchObjectRow.
@Override
protected ExasolTableIndexColumn[] fetchObjectRow(JDBCSession session, ExasolTable parent, ExasolTableIndex forObject, JDBCResultSet resultSet) throws SQLException, DBException {
// ToDo: fix regex
Matcher m = indexCols.matcher(JDBCUtils.safeGetString(resultSet, "REMARKS"));
String[] colString;
ArrayList<ExasolTableIndexColumn> indexCols = new ArrayList<ExasolTableIndexColumn>();
if (m.find()) {
colString = m.group(1).split(",");
for (int i = 0; i < colString.length; i++) {
ExasolTableColumn tableColumn = colString[i] == null ? null : parent.getAttribute(session.getProgressMonitor(), colString[i]);
indexCols.add(new ExasolTableIndexColumn(forObject, tableColumn, i + 1));
}
}
ExasolTableIndexColumn[] arrayIndexCols = new ExasolTableIndexColumn[indexCols.size()];
arrayIndexCols = indexCols.toArray(arrayIndexCols);
return arrayIndexCols;
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolTableIndexColumn in project dbeaver by serge-rider.
the class ExasolIndexConfigurator method configureObject.
@Override
public ExasolTableIndex configureObject(DBRProgressMonitor monitor, Object container, ExasolTableIndex index) {
return UITask.run(() -> {
EditIndexPage editPage = new EditIndexPage("create index", index, Arrays.asList(new DBSIndexType("LOCAL", "LOCAL"), new DBSIndexType("GLOBAL", "GLOBAL")), false);
if (!editPage.edit()) {
return null;
}
index.setIndexType(editPage.getIndexType());
int colIndex = 1;
for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
index.addColumn(new ExasolTableIndexColumn(index, (ExasolTableColumn) tableColumn, colIndex++));
}
index.setName(index.getIndexType().getName() + " INDEX " + index.getSimpleColumnString());
return index;
});
}
Aggregations