use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class MySQLCatalogManager method addObjectCreateActions.
@Override
protected void addObjectCreateActions(List<DBEPersistAction> actions, ObjectCreateCommand command) {
final MySQLCatalog catalog = command.getObject();
final StringBuilder script = new StringBuilder("CREATE SCHEMA `" + catalog.getName() + "`");
if (catalog.getDefaultCharset() != null) {
script.append("\nDEFAULT CHARACTER SET ").append(catalog.getDefaultCharset().getName());
}
if (catalog.getDefaultCollation() != null) {
script.append("\nDEFAULT COLLATE ").append(catalog.getDefaultCollation().getName());
}
actions.add(//$NON-NLS-2$
new SQLDatabasePersistAction("Create schema", script.toString()));
}
use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class MySQLTableColumnManager method addObjectModifyActions.
@Override
protected void addObjectModifyActions(List<DBEPersistAction> actionList, ObjectChangeCommand command) {
final MySQLTableColumn column = command.getObject();
actionList.add(new SQLDatabasePersistAction("Modify column", //$NON-NLS-1$ //$NON-NLS-2$
"ALTER TABLE " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + " MODIFY COLUMN " + getNestedDeclaration(column.getTable(), command)));
}
use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class MySQLTableColumnManager method addObjectRenameActions.
@Override
protected void addObjectRenameActions(List<DBEPersistAction> actions, ObjectRenameCommand command) {
final MySQLTableColumn column = command.getObject();
actions.add(new SQLDatabasePersistAction("Rename column", "ALTER TABLE " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + " CHANGE " + DBUtils.getQuotedIdentifier(column.getDataSource(), command.getOldName()) + " " + getNestedDeclaration(column.getTable(), command)));
}
use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class MySQLTableManager method addObjectRenameActions.
@Override
protected void addObjectRenameActions(List<DBEPersistAction> actions, ObjectRenameCommand command) {
final MySQLDataSource dataSource = command.getObject().getDataSource();
actions.add(new SQLDatabasePersistAction("Rename table", //$NON-NLS-1$
"RENAME TABLE " + command.getObject().getFullyQualifiedName(DBPEvaluationContext.DDL) + " TO " + DBUtils.getQuotedIdentifier(command.getObject().getContainer()) + "." + //$NON-NLS-1$
DBUtils.getQuotedIdentifier(dataSource, command.getNewName())));
}
use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.
the class MySQLTableManager method addObjectModifyActions.
@Override
protected void addObjectModifyActions(List<DBEPersistAction> actionList, ObjectChangeCommand command) {
//$NON-NLS-1$
StringBuilder query = new StringBuilder("ALTER TABLE ");
//$NON-NLS-1$
query.append(command.getObject().getFullyQualifiedName(DBPEvaluationContext.DDL)).append(" ");
appendTableModifiers(command.getObject(), command, query);
actionList.add(new SQLDatabasePersistAction(query.toString()));
}
Aggregations