use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by serge-rider.
the class OracleTableColumnManager method addObjectRenameActions.
@Override
protected void addObjectRenameActions(List<DBEPersistAction> actions, ObjectRenameCommand command) {
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())));
}
use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by serge-rider.
the class OracleTableColumnManager method createDatabaseObject.
@Override
protected OracleTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, OracleTableBase parent, Object copyFrom) {
//$NON-NLS-1$
DBSDataType columnType = findBestDataType(parent.getDataSource(), "varchar2");
final OracleTableColumn column = new OracleTableColumn(parent);
column.setName(getNewColumnName(monitor, context, parent));
column.setDataType((OracleDataType) columnType);
//$NON-NLS-1$
column.setTypeName(columnType == null ? "INTEGER" : columnType.getName());
column.setMaxLength(columnType != null && columnType.getDataKind() == DBPDataKind.STRING ? 100 : 0);
column.setValueType(columnType == null ? Types.INTEGER : columnType.getTypeID());
column.setOrdinalPosition(-1);
return column;
}
use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by serge-rider.
the class OracleTableColumnManager method addObjectModifyActions.
@Override
protected void addObjectModifyActions(List<DBEPersistAction> actionList, ObjectChangeCommand command) {
final OracleTableColumn column = command.getObject();
boolean hasComment = command.getProperty("comment") != null;
if (!hasComment || command.getProperties().size() > 1) {
actionList.add(new SQLDatabasePersistAction("Modify column", //$NON-NLS-1$
"ALTER TABLE " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + " MODIFY " + //$NON-NLS-1$
getNestedDeclaration(column.getTable(), command)));
}
if (hasComment) {
actionList.add(new SQLDatabasePersistAction("Comment column", "COMMENT ON COLUMN " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + "." + DBUtils.getQuotedIdentifier(column) + " IS '" + column.getComment(VoidProgressMonitor.INSTANCE) + "'"));
}
}
use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by dbeaver.
the class OracleTableColumnManager method addObjectModifyActions.
@Override
protected void addObjectModifyActions(List<DBEPersistAction> actionList, ObjectChangeCommand command, Map<String, Object> options) {
final OracleTableColumn column = command.getObject();
boolean hasComment = command.getProperty("comment") != null;
if (!hasComment || command.getProperties().size() > 1) {
actionList.add(new SQLDatabasePersistAction("Modify column", // $NON-NLS-1$
"ALTER TABLE " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + " MODIFY " + // $NON-NLS-1$
getNestedDeclaration(column.getTable(), command, options)));
}
if (hasComment) {
actionList.add(new SQLDatabasePersistAction("Comment column", "COMMENT ON COLUMN " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + "." + DBUtils.getQuotedIdentifier(column) + " IS '" + column.getComment(new VoidProgressMonitor()) + "'"));
}
}
use of org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn in project dbeaver by dbeaver.
the class OracleTableColumnManager method createDatabaseObject.
@Override
protected OracleTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, OracleTableBase parent, Object copyFrom) {
// $NON-NLS-1$
DBSDataType columnType = findBestDataType(parent.getDataSource(), "varchar2");
final OracleTableColumn column = new OracleTableColumn(parent);
column.setName(getNewColumnName(monitor, context, parent));
column.setDataType((OracleDataType) columnType);
// $NON-NLS-1$
column.setTypeName(columnType == null ? "INTEGER" : columnType.getName());
column.setMaxLength(columnType != null && columnType.getDataKind() == DBPDataKind.STRING ? 100 : 0);
column.setValueType(columnType == null ? Types.INTEGER : columnType.getTypeID());
column.setOrdinalPosition(-1);
return column;
}
Aggregations