Search in sources :

Example 1 with OracleTableColumn

use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by dbeaver.

the class OracleTableColumnManager method addObjectRenameActions.

@Override
protected void addObjectRenameActions(List<DBEPersistAction> actions, ObjectRenameCommand command, Map<String, Object> options) {
    final OracleTableColumn 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())));
}
Also used : OracleTableColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn) SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Example 2 with OracleTableColumn

use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by serge-rider.

the class OracleForeignKeyConfigurator method configureObject.

@Override
public OracleTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, OracleTableForeignKey foreignKey) {
    return UITask.run(() -> {
        EditForeignKeyPage editPage = new EditForeignKeyPage(OracleUIMessages.edit_oracle_foreign_key_manager_dialog_title, foreignKey, new DBSForeignKeyModifyRule[] { DBSForeignKeyModifyRule.NO_ACTION, DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT, DBSForeignKeyModifyRule.SET_NULL, DBSForeignKeyModifyRule.SET_DEFAULT });
        editPage.setSupportsCustomName(true);
        if (!editPage.edit()) {
            return null;
        }
        foreignKey.setReferencedConstraint((OracleTableConstraint) editPage.getUniqueConstraint());
        foreignKey.setName(editPage.getName());
        foreignKey.setDeleteRule(editPage.getOnDeleteRule());
        int colIndex = 1;
        for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
            foreignKey.addColumn(new OracleTableForeignKeyColumn(foreignKey, (OracleTableColumn) tableColumn.getOwnColumn(), colIndex++));
        }
        return foreignKey;
    });
}
Also used : OracleTableForeignKeyColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableForeignKeyColumn) OracleTableColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn) EditForeignKeyPage(org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage) OracleTableConstraint(org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint)

Example 3 with OracleTableColumn

use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by dbeaver.

the class OracleIndexConfigurator method configureObject.

@Override
public OracleTableIndex configureObject(DBRProgressMonitor monitor, Object container, OracleTableIndex index) {
    return UITask.run(() -> {
        EditIndexPage editPage = new EditIndexPage(OracleUIMessages.edit_oracle_index_manager_dialog_title, index, Collections.singletonList(DBSIndexType.OTHER));
        if (!editPage.edit()) {
            return null;
        }
        StringBuilder idxName = new StringBuilder(64);
        // $NON-NLS-1$
        idxName.append(CommonUtils.escapeIdentifier(index.getTable().getName())).append("_").append(CommonUtils.escapeIdentifier(editPage.getSelectedAttributes().iterator().next().getName())).append(// $NON-NLS-1$
        "_IDX");
        index.setName(DBObjectNameCaseTransformer.transformName(index.getDataSource(), idxName.toString()));
        index.setUnique(editPage.isUnique());
        index.setIndexType(editPage.getIndexType());
        int colIndex = 1;
        for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
            index.addColumn(new OracleTableIndexColumn(index, (OracleTableColumn) tableColumn, colIndex++, !Boolean.TRUE.equals(editPage.getAttributeProperty(tableColumn, EditIndexPage.PROP_DESC)), null));
        }
        return index;
    });
}
Also used : DBSEntityAttribute(org.jkiss.dbeaver.model.struct.DBSEntityAttribute) OracleTableColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn) OracleTableIndexColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableIndexColumn) EditIndexPage(org.jkiss.dbeaver.ui.editors.object.struct.EditIndexPage)

Example 4 with OracleTableColumn

use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by dbeaver.

the class OracleForeignKeyConfigurator method configureObject.

@Override
public OracleTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, OracleTableForeignKey foreignKey) {
    return UITask.run(() -> {
        EditForeignKeyPage editPage = new EditForeignKeyPage(OracleUIMessages.edit_oracle_foreign_key_manager_dialog_title, foreignKey, new DBSForeignKeyModifyRule[] { DBSForeignKeyModifyRule.NO_ACTION, DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT, DBSForeignKeyModifyRule.SET_NULL, DBSForeignKeyModifyRule.SET_DEFAULT });
        editPage.setSupportsCustomName(true);
        if (!editPage.edit()) {
            return null;
        }
        foreignKey.setReferencedConstraint((OracleTableConstraint) editPage.getUniqueConstraint());
        foreignKey.setName(editPage.getName());
        foreignKey.setDeleteRule(editPage.getOnDeleteRule());
        int colIndex = 1;
        for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
            foreignKey.addColumn(new OracleTableForeignKeyColumn(foreignKey, (OracleTableColumn) tableColumn.getOwnColumn(), colIndex++));
        }
        return foreignKey;
    });
}
Also used : OracleTableForeignKeyColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableForeignKeyColumn) OracleTableColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn) EditForeignKeyPage(org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage) OracleTableConstraint(org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint)

Example 5 with OracleTableColumn

use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by dbeaver.

the class OracleTableColumnManager method addObjectRenameActions.

@Override
protected void addObjectRenameActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectRenameCommand command, Map<String, Object> options) {
    final OracleTableColumn 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())));
}
Also used : OracleTableColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn) SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Aggregations

OracleTableColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn)18 SQLDatabasePersistAction (org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)8 OracleTableConstraint (org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint)4 DBSDataType (org.jkiss.dbeaver.model.struct.DBSDataType)4 DBSEntityAttribute (org.jkiss.dbeaver.model.struct.DBSEntityAttribute)4 OracleTableBase (org.jkiss.dbeaver.ext.oracle.model.OracleTableBase)2 OracleTableConstraintColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraintColumn)2 OracleTableForeignKeyColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableForeignKeyColumn)2 OracleTableIndexColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableIndexColumn)2 EditConstraintPage (org.jkiss.dbeaver.ui.editors.object.struct.EditConstraintPage)2 EditForeignKeyPage (org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage)2 EditIndexPage (org.jkiss.dbeaver.ui.editors.object.struct.EditIndexPage)2 VoidProgressMonitor (org.jkiss.dbeaver.model.runtime.VoidProgressMonitor)1