use of com.cubrid.cubridmanager.core.cubrid.trigger.task.JDBCSqlExecuteTask in project cubrid-manager by CUBRID.
the class CreateTriggerDialog method executeByJDBC.
/**
*
* Execute to add or alter trigger by JDBC
*
* @param buttonId int
*/
private void executeByJDBC(int buttonId) {
// FIXME move this logic to core module
String createSQL = generateSqlText().toString();
if (StringUtil.isEmpty(createSQL)) {
return;
}
String taskName = null;
String message = null;
if (buttonId == IDialogConstants.OK_ID) {
taskName = Messages.bind(Messages.addTriggerTaskName, triggerName);
message = Messages.newTriggerSuccess;
} else if (buttonId == ALTER_TRIGGER_OK_ID) {
createSQL = createSQL.substring(createSQL.indexOf("ALTER TRIGGER "));
message = Messages.alterTriggerSuccess;
taskName = Messages.bind(Messages.alterTriggerTaskName, triggerName);
}
// add or alter triggers by JDBC
JDBCSqlExecuteTask jdbcTask = new JDBCSqlExecuteTask(taskName, database.getDatabaseInfo(), createSQL);
TaskExecutor taskExecutor = new CommonTaskExec(taskName);
taskExecutor.addTask(jdbcTask);
new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
if (taskExecutor.isSuccess()) {
triggerName = triggerNameText.getText();
setReturnCode(buttonId);
close();
CommonUITool.openInformationBox(Messages.msgInformation, message);
}
}
Aggregations