Search in sources :

Example 16 with SQLDatabasePersistAction

use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.

the class PostgreProcedureManager method addObjectDeleteActions.

@Override
protected void addObjectDeleteActions(List<DBEPersistAction> actions, ObjectDeleteCommand command) {
    String objectType = command.getObject().getProcedureTypeName();
    actions.add(//$NON-NLS-2$
    new SQLDatabasePersistAction("Drop procedure", "DROP " + objectType + " " + command.getObject().getFullQualifiedSignature()));
}
Also used : SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Example 17 with SQLDatabasePersistAction

use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.

the class PostgreSchemaManager method addObjectCreateActions.

@Override
protected void addObjectCreateActions(List<DBEPersistAction> actions, ObjectCreateCommand command) {
    final PostgreSchema schema = command.getObject();
    final StringBuilder script = new StringBuilder("CREATE SCHEMA " + DBUtils.getQuotedIdentifier(schema));
    try {
        final PostgreRole owner = schema.getOwner(VoidProgressMonitor.INSTANCE);
        if (owner != null) {
            script.append("\nAUTHORIZATION ").append(owner.getName());
        }
    } catch (DBException e) {
        log.error(e);
    }
    actions.add(//$NON-NLS-2$
    new SQLDatabasePersistAction("Create schema", script.toString()));
}
Also used : DBException(org.jkiss.dbeaver.DBException) PostgreRole(org.jkiss.dbeaver.ext.postgresql.model.PostgreRole) PostgreSchema(org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema) SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Example 18 with SQLDatabasePersistAction

use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.

the class OracleSequenceManager 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));
    }
}
Also used : SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Example 19 with SQLDatabasePersistAction

use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.

the class OracleSequenceManager 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));
    }
}
Also used : SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Example 20 with SQLDatabasePersistAction

use of org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction in project dbeaver by serge-rider.

the class OracleTableTriggerManager method createOrReplaceTriggerQuery.

protected void createOrReplaceTriggerQuery(List<DBEPersistAction> actions, OracleTableTrigger trigger) {
    String source = OracleUtils.normalizeSourceName(trigger, false);
    if (source == null) {
        return;
    }
    //$NON-NLS-2$
    actions.add(new SQLDatabasePersistAction("Create trigger", "CREATE OR REPLACE " + source, true));
    OracleUtils.addSchemaChangeActions(actions, trigger);
}
Also used : SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Aggregations

SQLDatabasePersistAction (org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)55 DBEPersistAction (org.jkiss.dbeaver.model.edit.DBEPersistAction)10 DBException (org.jkiss.dbeaver.DBException)3 MySQLTableColumn (org.jkiss.dbeaver.ext.mysql.model.MySQLTableColumn)3 DB2TableColumn (org.jkiss.dbeaver.ext.db2.model.DB2TableColumn)2 ExasolTableColumn (org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn)2 OracleTableColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn)2 ArrayList (java.util.ArrayList)1 NotNull (org.jkiss.code.NotNull)1 ExasolView (org.jkiss.dbeaver.ext.exasol.model.ExasolView)1 GenericDataSource (org.jkiss.dbeaver.ext.generic.model.GenericDataSource)1 MySQLCatalog (org.jkiss.dbeaver.ext.mysql.model.MySQLCatalog)1 MySQLDataSource (org.jkiss.dbeaver.ext.mysql.model.MySQLDataSource)1 MySQLView (org.jkiss.dbeaver.ext.mysql.model.MySQLView)1 OracleDataType (org.jkiss.dbeaver.ext.oracle.model.OracleDataType)1 OracleUser (org.jkiss.dbeaver.ext.oracle.model.OracleUser)1 OracleView (org.jkiss.dbeaver.ext.oracle.model.OracleView)1 PostgreDatabase (org.jkiss.dbeaver.ext.postgresql.model.PostgreDatabase)1 PostgreRole (org.jkiss.dbeaver.ext.postgresql.model.PostgreRole)1 PostgreSchema (org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema)1