use of org.jkiss.dbeaver.ext.exasol.model.ExasolConnection in project dbeaver by dbeaver.
the class ExasolConnectionManager method addObjectDeleteActions.
@Override
protected void addObjectDeleteActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectDeleteCommand command, Map<String, Object> options) {
final ExasolConnection con = command.getObject();
actions.add(new SQLDatabasePersistAction("Drop Connection", "DROP CONNECTION " + DBUtils.getQuotedIdentifier(con)));
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolConnection in project dbeaver by dbeaver.
the class ExasolConnectionManager method addObjectModifyActions.
@Override
protected void addObjectModifyActions(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(Comment(con));
}
// url, username or password have changed
if (com.containsKey("url") | com.containsKey("userName") | com.containsKey("password")) {
// possible loss of information - warn
if ((com.containsKey("url") | com.containsKey("userName")) & !con.getUserName().isEmpty() & con.getPassword().isEmpty()) {
int result = new UITask<Integer>() {
protected Integer runTask() {
ConfirmationDialog dialog = new ConfirmationDialog(DBeaverUI.getActiveWorkbenchShell(), ExasolMessages.dialog_connection_alter_title, null, ExasolMessages.dialog_connection_alter_message, MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, ExasolMessages.dialog_general_continue, false);
return dialog.open();
}
}.execute();
if (result != IDialogConstants.YES_ID) {
throw new IllegalStateException("User abort");
}
}
StringBuilder script = new StringBuilder(String.format("ALTER CONNECTION %s ", 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()));
}
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolConnection in project dbeaver by serge-rider.
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())));
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolConnection in project dbeaver by serge-rider.
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()));
}
}
use of org.jkiss.dbeaver.ext.exasol.model.ExasolConnection in project dbeaver by dbeaver.
the class ExasolConnectionManager method addObjectCreateActions.
@Override
protected void addObjectCreateActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectCreateCommand command, Map<String, Object> options) {
final ExasolConnection con = command.getObject();
StringBuilder script = new StringBuilder(String.format("CREATE 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())));
}
actions.add(new SQLDatabasePersistAction("Create Connection", script.toString()));
if (!con.getDescription().isEmpty()) {
actions.add(getCommentCommand(con));
}
}
Aggregations