Search in sources :

Example 1 with SQLExecution

use of net.sourceforge.sqlexplorer.sqlpanel.SQLExecution in project tdq-studio-se by Talend.

the class ExecSQLAction method run.

protected void run(int maxRows) {
    Session session = getSession();
    if (session == null)
        return;
    QueryParser qt = session.getDatabaseProduct().getQueryParser(_editor.getSQLToBeExecuted(), _editor.getSQLLineNumber());
    try {
        qt.parse();
    } catch (final ParserException e) {
        _editor.getSite().getShell().getDisplay().asyncExec(new Runnable() {

            public void run() {
                MessageDialog.openError(_editor.getSite().getShell(), Messages.getString("SQLResultsView.Error.Title"), e.getMessage());
            }
        });
    }
    if (qt.iterator().hasNext()) {
        boolean clearResults = SQLExplorerPlugin.getDefault().getPreferenceStore().getBoolean(IConstants.CLEAR_RESULTS_ON_EXECUTE);
        if (clearResults)
            _editor.clearResults();
        AbstractSQLExecution job = new SQLExecution(_editor, qt, maxRows);
        job.schedule();
    }
}
Also used : ParserException(net.sourceforge.sqlexplorer.parsers.ParserException) QueryParser(net.sourceforge.sqlexplorer.parsers.QueryParser) AbstractSQLExecution(net.sourceforge.sqlexplorer.sqlpanel.AbstractSQLExecution) SQLExecution(net.sourceforge.sqlexplorer.sqlpanel.SQLExecution) AbstractSQLExecution(net.sourceforge.sqlexplorer.sqlpanel.AbstractSQLExecution) Session(net.sourceforge.sqlexplorer.dbproduct.Session)

Aggregations

Session (net.sourceforge.sqlexplorer.dbproduct.Session)1 ParserException (net.sourceforge.sqlexplorer.parsers.ParserException)1 QueryParser (net.sourceforge.sqlexplorer.parsers.QueryParser)1 AbstractSQLExecution (net.sourceforge.sqlexplorer.sqlpanel.AbstractSQLExecution)1 SQLExecution (net.sourceforge.sqlexplorer.sqlpanel.SQLExecution)1