use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class DB2SequenceManager method addObjectCreateActions.
@Override
protected void addObjectCreateActions(List<DBEPersistAction> actions, ObjectCreateCommand command) {
String sql = buildStatement(command.getObject(), false);
actions.add(new SQLDatabasePersistAction("Create Sequence", sql));
String comment = buildComment(command.getObject());
if (comment != null) {
actions.add(new SQLDatabasePersistAction("Comment on Sequence", comment));
}
}
use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class DB2SequenceManager method addObjectModifyActions.
@Override
protected void addObjectModifyActions(List<DBEPersistAction> actionList, ObjectChangeCommand command) {
String sql = buildStatement(command.getObject(), true);
actionList.add(new SQLDatabasePersistAction("Alter Sequence", sql));
String comment = buildComment(command.getObject());
if (comment != null) {
actionList.add(new SQLDatabasePersistAction("Comment on Sequence", comment));
}
}
use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class PostgreTableColumnManager method addObjectRenameActions.
@Override
protected void addObjectRenameActions(List<DBEPersistAction> actions, ObjectRenameCommand command) {
final PostgreAttribute column = command.getObject();
actions.add(new SQLDatabasePersistAction("Rename column", "ALTER TABLE " + DBUtils.getObjectFullName(column.getTable(), DBPEvaluationContext.DDL) + " RENAME COLUMN " + DBUtils.getQuotedIdentifier(column.getDataSource(), command.getOldName()) + " TO " + DBUtils.getQuotedIdentifier(column.getDataSource(), command.getNewName())));
}
use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class PostgreViewManager method addObjectDeleteActions.
@Override
protected void addObjectDeleteActions(List<DBEPersistAction> actions, ObjectDeleteCommand command) {
PostgreViewBase view = (PostgreViewBase) command.getObject();
actions.add(//$NON-NLS-2$
new SQLDatabasePersistAction("Drop view", "DROP " + view.getViewType() + " " + view.getFullyQualifiedName(DBPEvaluationContext.DDL)));
}
use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class MySQLViewManager method createOrReplaceViewQuery.
private void createOrReplaceViewQuery(List<DBEPersistAction> actions, MySQLView view) {
StringBuilder decl = new StringBuilder(200);
final String lineSeparator = GeneralUtils.getDefaultLineSeparator();
//$NON-NLS-1$
decl.append("CREATE OR REPLACE VIEW ").append(view.getFullyQualifiedName(DBPEvaluationContext.DDL)).append(lineSeparator).append("AS ").append(//$NON-NLS-1$
view.getAdditionalInfo().getDefinition());
final MySQLView.CheckOption checkOption = view.getAdditionalInfo().getCheckOption();
if (checkOption != null && checkOption != MySQLView.CheckOption.NONE) {
//$NON-NLS-1$ //$NON-NLS-2$
decl.append(lineSeparator).append("WITH ").append(checkOption.getDefinitionName()).append(" CHECK OPTION");
}
actions.add(new SQLDatabasePersistAction("Create view", decl.toString()));
}
Aggregations