Search in sources :

Example 1 with SQLQueryTransformerCount

use of org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerCount in project dbeaver by dbeaver.

the class ExecuteHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    SQLEditor editor = RuntimeUtils.getObjectAdapter(HandlerUtil.getActiveEditor(event), SQLEditor.class);
    if (editor == null) {
        log.error("No active SQL editor found");
        return null;
    }
    String actionId = event.getCommand().getId();
    switch(actionId) {
        case CoreCommands.CMD_EXECUTE_STATEMENT:
            editor.processSQL(false, false);
            break;
        case CoreCommands.CMD_EXECUTE_STATEMENT_NEW:
            editor.processSQL(true, false);
            break;
        case CoreCommands.CMD_EXECUTE_SCRIPT:
            editor.processSQL(false, true);
            break;
        case CoreCommands.CMD_EXECUTE_SCRIPT_NEW:
            editor.processSQL(true, true);
            break;
        case CoreCommands.CMD_EXECUTE_ROW_COUNT:
            editor.processSQL(false, false, new SQLQueryTransformerCount(), null);
            break;
        case CoreCommands.CMD_EXECUTE_EXPRESSION:
            editor.processSQL(false, false, new SQLQueryTransformerExpression(), null);
            break;
        case CoreCommands.CMD_EXECUTE_ALL_ROWS:
            editor.processSQL(false, false, new SQLQueryTransformerAllRows(), null);
            break;
        case CoreCommands.CMD_EXPLAIN_PLAN:
            editor.explainQueryPlan();
            break;
        default:
            log.error("Unsupported SQL editor command: " + actionId);
            break;
    }
    return null;
}
Also used : SQLEditor(org.jkiss.dbeaver.ui.editors.sql.SQLEditor) SQLQueryTransformerCount(org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerCount) SQLQueryTransformerExpression(org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerExpression) SQLQueryTransformerAllRows(org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerAllRows)

Example 2 with SQLQueryTransformerCount

use of org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerCount in project dbeaver by serge-rider.

the class ExecuteHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    SQLEditor editor = RuntimeUtils.getObjectAdapter(HandlerUtil.getActiveEditor(event), SQLEditor.class);
    if (editor == null) {
        log.error("No active SQL editor found");
        return null;
    }
    String actionId = event.getCommand().getId();
    switch(actionId) {
        case CoreCommands.CMD_EXECUTE_STATEMENT:
            editor.processSQL(false, false);
            break;
        case CoreCommands.CMD_EXECUTE_STATEMENT_NEW:
            editor.processSQL(true, false);
            break;
        case CoreCommands.CMD_EXECUTE_SCRIPT:
            editor.processSQL(false, true);
            break;
        case CoreCommands.CMD_EXECUTE_SCRIPT_NEW:
            editor.processSQL(true, true);
            break;
        case CoreCommands.CMD_EXECUTE_ROW_COUNT:
            editor.processSQL(false, false, new SQLQueryTransformerCount());
            break;
        case CoreCommands.CMD_EXECUTE_EXPRESSION:
            editor.processSQL(false, false, new SQLQueryTransformerExpression());
            break;
        case CoreCommands.CMD_EXPLAIN_PLAN:
            editor.explainQueryPlan();
            break;
        default:
            log.error("Unsupported SQL editor command: " + actionId);
            break;
    }
    return null;
}
Also used : SQLEditor(org.jkiss.dbeaver.ui.editors.sql.SQLEditor) SQLQueryTransformerCount(org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerCount) SQLQueryTransformerExpression(org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerExpression)

Example 3 with SQLQueryTransformerCount

use of org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerCount in project dbeaver by serge-rider.

the class SQLEditorHandlerExecute method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    SQLEditor editor = RuntimeUtils.getObjectAdapter(HandlerUtil.getActiveEditor(event), SQLEditor.class);
    if (editor == null) {
        log.error("No active SQL editor found");
        return null;
    }
    String actionId = event.getCommand().getId();
    switch(actionId) {
        case SQLEditorCommands.CMD_EXECUTE_STATEMENT:
            editor.processSQL(false, false);
            break;
        case SQLEditorCommands.CMD_EXECUTE_STATEMENT_NEW:
            editor.processSQL(true, false);
            break;
        case SQLEditorCommands.CMD_EXECUTE_SCRIPT:
            editor.processSQL(false, true);
            break;
        case SQLEditorCommands.CMD_EXECUTE_SCRIPT_NEW:
            editor.processSQL(true, true);
            break;
        case SQLEditorCommands.CMD_EXECUTE_ROW_COUNT:
            editor.processSQL(false, false, new SQLQueryTransformerCount(), null);
            break;
        case SQLEditorCommands.CMD_EXECUTE_EXPRESSION:
            editor.processSQL(false, false, new SQLQueryTransformerExpression(), null);
            break;
        case SQLEditorCommands.CMD_EXECUTE_ALL_ROWS:
            editor.processSQL(false, false, new SQLQueryTransformerAllRows(), null);
            break;
        case SQLEditorCommands.CMD_EXPLAIN_PLAN:
            editor.explainQueryPlan();
            break;
        case SQLEditorCommands.CMD_LOAD_PLAN:
            editor.loadQueryPlan();
            break;
        default:
            log.error("Unsupported SQL editor command: " + actionId);
            break;
    }
    editor.refreshActions();
    return null;
}
Also used : SQLEditor(org.jkiss.dbeaver.ui.editors.sql.SQLEditor) SQLQueryTransformerCount(org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerCount) SQLQueryTransformerExpression(org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerExpression) SQLQueryTransformerAllRows(org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerAllRows)

Aggregations

SQLQueryTransformerCount (org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerCount)3 SQLQueryTransformerExpression (org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerExpression)3 SQLEditor (org.jkiss.dbeaver.ui.editors.sql.SQLEditor)3 SQLQueryTransformerAllRows (org.jkiss.dbeaver.model.impl.sql.SQLQueryTransformerAllRows)2