use of org.jkiss.dbeaver.ext.generic.model.GenericView in project dbeaver by serge-rider.
the class GenericViewManager method createOrReplaceViewQuery.
private void createOrReplaceViewQuery(List<DBEPersistAction> actions, DBECommandComposite<GenericTableBase, PropertyHandler> command) {
final GenericView view = (GenericView) command.getObject();
actions.add(new SQLDatabasePersistAction("Create view", view.getDDL()));
}
use of org.jkiss.dbeaver.ext.generic.model.GenericView in project dbeaver by serge-rider.
the class GenericViewManager method addObjectModifyActions.
@Override
protected void addObjectModifyActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actionList, ObjectChangeCommand command, Map<String, Object> options) {
final GenericView view = (GenericView) command.getObject();
boolean hasComment = command.hasProperty(DBConstants.PROP_ID_DESCRIPTION);
if (!hasComment || command.getProperties().size() > 1) {
actionList.add(new SQLDatabasePersistAction("Create view", view.getDDL()));
}
if (hasComment) {
actionList.add(new SQLDatabasePersistAction("Comment view", "COMMENT ON VIEW " + command.getObject().getFullyQualifiedName(DBPEvaluationContext.DDL) + " IS " + SQLUtils.quoteString(command.getObject(), CommonUtils.notEmpty(command.getObject().getDescription()))));
}
}
use of org.jkiss.dbeaver.ext.generic.model.GenericView in project dbeaver by serge-rider.
the class GenericViewManager method createDatabaseObject.
@Override
protected GenericTableBase createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, Object container, Object copyFrom, Map<String, Object> options) {
GenericStructContainer structContainer = (GenericStructContainer) container;
String tableName = getNewChildName(monitor, structContainer, SQLTableManager.BASE_VIEW_NAME);
GenericTableBase viewImpl = structContainer.getDataSource().getMetaModel().createTableImpl(structContainer, tableName, GenericConstants.TABLE_TYPE_VIEW, null);
if (viewImpl instanceof GenericView) {
((GenericView) viewImpl).setObjectDefinitionText("CREATE VIEW " + viewImpl.getFullyQualifiedName(DBPEvaluationContext.DDL) + " AS SELECT 1 as A\n");
}
return viewImpl;
}
Aggregations