Search in sources :

Example 1 with JDBCSqlExecuteTask

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);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) JDBCSqlExecuteTask(com.cubrid.cubridmanager.core.cubrid.trigger.task.JDBCSqlExecuteTask)

Aggregations

CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)1 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)1 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)1 JDBCSqlExecuteTask (com.cubrid.cubridmanager.core.cubrid.trigger.task.JDBCSqlExecuteTask)1