use of org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn in project dbeaver by dbeaver.
the class ExasolTableColumnManager method createDatabaseObject.
// ------
// Create
// ------
@Override
protected ExasolTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, ExasolTableBase parent, Object copyFrom) {
ExasolTableColumn column = new ExasolTableColumn(parent);
column.setName(getNewColumnName(monitor, context, parent));
return column;
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn in project dbeaver by dbeaver.
the class ExasolTableColumnManager method modifyDistKey.
private Collection<SQLDatabasePersistAction> modifyDistKey(DBRProgressMonitor monitor, ExasolTableColumn exasolColumn) throws DBException {
ExasolTable table = (ExasolTable) exasolColumn.getParentObject();
Collection<ExasolTableColumn> distKey = table.getDistributionKey(monitor);
Collection<SQLDatabasePersistAction> commands = new ArrayList<SQLDatabasePersistAction>();
if (table.getAdditionalInfo(monitor).getHasDistKey(monitor)) {
commands.add(generateDropDist(exasolColumn));
}
if (!distKey.isEmpty())
commands.add(generateCreateDist(distKey));
return commands;
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn in project dbeaver by dbeaver.
the class ExasolTableColumnManager method addObjectRenameActions.
@Override
protected void addObjectRenameActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectRenameCommand command, Map<String, Object> options) {
final ExasolTableColumn column = command.getObject();
actions.add(new SQLDatabasePersistAction("Rename column", "ALTER TABLE " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + " RENAME COLUMN " + DBUtils.getQuotedIdentifier(column.getDataSource(), command.getOldName()) + " TO " + DBUtils.getQuotedIdentifier(column.getDataSource(), command.getNewName())));
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn in project dbeaver by dbeaver.
the class ExasolTableColumnManager method generateCreateDist.
private SQLDatabasePersistAction generateCreateDist(Collection<ExasolTableColumn> distKey) {
ExasolTable table = null;
Collection<String> names = new ArrayList<>();
for (ExasolTableColumn c : distKey) {
if (table == null)
table = (ExasolTable) c.getParentObject();
names.add(c.getName());
}
return new SQLDatabasePersistAction("Create Distribution Key", String.format(CREATE_DIST_KEY, table.getFullyQualifiedName(DBPEvaluationContext.DDL), CommonUtils.joinStrings(",", names)));
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn in project dbeaver by dbeaver.
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