Search in sources :

Example 11 with ExasolConnection

use of org.jkiss.dbeaver.ext.exasol.model.ExasolConnection in project dbeaver by dbeaver.

the class ExasolConnectionManager method addObjectRenameActions.

@Override
protected void addObjectRenameActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectRenameCommand command, Map<String, Object> options) {
    ExasolConnection obj = command.getObject();
    actions.add(new SQLDatabasePersistAction("Rename Connection", "RENAME CONNECTION " + DBUtils.getQuotedIdentifier(obj.getDataSource(), command.getOldName()) + " to " + DBUtils.getQuotedIdentifier(obj.getDataSource(), command.getNewName())));
}
Also used : ExasolConnection(org.jkiss.dbeaver.ext.exasol.model.ExasolConnection) SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Example 12 with ExasolConnection

use of org.jkiss.dbeaver.ext.exasol.model.ExasolConnection in project dbeaver by dbeaver.

the class ExasolConnectionManager method addObjectModifyActions.

@Override
protected void addObjectModifyActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actionList, ObjectChangeCommand command, Map<String, Object> options) {
    ExasolConnection con = command.getObject();
    Map<Object, Object> com = command.getProperties();
    if (com.containsKey("description")) {
        actionList.add(getCommentCommand(con));
    }
    // url, username or password have changed
    if (com.containsKey("url") | com.containsKey("userName") | com.containsKey("password")) {
        // possible loss of information - warn
        StringBuilder script = new StringBuilder(String.format("ALTER CONNECTION %s TO", DBUtils.getQuotedIdentifier(con)));
        script.append(" '" + ExasolUtils.quoteString(con.getConnectionString()) + "' ");
        if (!(con.getUserName().isEmpty() | con.getPassword().isEmpty())) {
            script.append(String.format(" USER '%s' IDENTIFIED BY '%s'", ExasolUtils.quoteString(con.getUserName()), ExasolUtils.quoteString(con.getPassword())));
        }
        actionList.add(new SQLDatabasePersistAction("alter Connection", script.toString()));
    }
}
Also used : ExasolConnection(org.jkiss.dbeaver.ext.exasol.model.ExasolConnection) SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Aggregations

ExasolConnection (org.jkiss.dbeaver.ext.exasol.model.ExasolConnection)12 SQLDatabasePersistAction (org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)12 ConfirmationDialog (org.jkiss.dbeaver.ui.dialogs.ConfirmationDialog)1