Search in sources :

Example 1 with TextRecordProcessor

use of com.cubrid.common.ui.query.tuner.TextRecordProcessor in project cubrid-manager by CUBRID.

the class QueryRecordListComparator method runQueryPlan.

/**
	 * Run query plan
	 *
	 */
private void runQueryPlan() {
    String query = getFirstSelectedQuery();
    if (StringUtil.isEmpty(query)) {
        return;
    }
    runItem.setEnabled(false);
    runPlanItem.setEnabled(false);
    List<String> queryList = new ArrayList<String>();
    queryList.add(query);
    QueryTunerJob job = new QueryTunerJob(IQueryJob.RUN_PLAN | /*IQueryJob.COLLECT_STAT | */
    IQueryJob.AUTO_COMMIT, database.getDatabaseInfo(), queryList, new TextRecordProcessor(), QueryTunerDialog.this);
    job.schedule();
    try {
        job.join();
        List<QueryRecord> queryRecordList = job.getQueryRecordList();
        if (queryRecordList.size() > 0) {
            lastRecord = currentRecord;
            currentRecord = queryRecordList.get(0);
            displayQueryPlan(currentRecord);
        }
    } catch (InterruptedException e) {
        LOGGER.error(e.getMessage());
    }
    runItem.setEnabled(true);
    runPlanItem.setEnabled(true);
}
Also used : TextRecordProcessor(com.cubrid.common.ui.query.tuner.TextRecordProcessor) ArrayList(java.util.ArrayList) QueryTunerJob(com.cubrid.common.ui.query.tuner.QueryTunerJob) QueryRecord(com.cubrid.common.ui.query.tuner.QueryRecord)

Example 2 with TextRecordProcessor

use of com.cubrid.common.ui.query.tuner.TextRecordProcessor in project cubrid-manager by CUBRID.

the class QueryRecordListComparator method runQuery.

/**
	 * Run query
	 */
private void runQuery() {
    String query = getFirstSelectedQuery();
    if (StringUtil.isEmpty(query)) {
        return;
    }
    runItem.setEnabled(false);
    runPlanItem.setEnabled(false);
    List<String> queryList = new ArrayList<String>();
    queryList.add(query);
    QueryTunerJob job = new QueryTunerJob(IQueryJob.RUN_QUERY | IQueryJob.RUN_PLAN | IQueryJob.COLLECT_STAT | IQueryJob.AUTO_COMMIT, database.getDatabaseInfo(), queryList, new TextRecordProcessor(), QueryTunerDialog.this);
    job.schedule();
    try {
        job.join();
        List<QueryRecord> queryRecordList = job.getQueryRecordList();
        if (queryRecordList.size() > 0) {
            lastRecord = currentRecord;
            currentRecord = queryRecordList.get(0);
            displayQuery(currentRecord);
            displayQueryPlan(currentRecord);
        }
    } catch (InterruptedException e) {
        LOGGER.error(e.getMessage());
    }
    runItem.setEnabled(true);
    runPlanItem.setEnabled(true);
}
Also used : TextRecordProcessor(com.cubrid.common.ui.query.tuner.TextRecordProcessor) ArrayList(java.util.ArrayList) QueryTunerJob(com.cubrid.common.ui.query.tuner.QueryTunerJob) QueryRecord(com.cubrid.common.ui.query.tuner.QueryRecord)

Example 3 with TextRecordProcessor

use of com.cubrid.common.ui.query.tuner.TextRecordProcessor in project cubrid-manager by CUBRID.

the class QueryRecordListComparator method runQueryPlanAgain.

/**
	 * Run query plan for compare tab
	 *
	 * @param leftQuery
	 * @param rightQuery
	 */
private void runQueryPlanAgain(String leftQuery, String rightQuery) {
    multiRunItem.setEnabled(false);
    List<String> queryList = new ArrayList<String>();
    if (!StringUtil.isEmpty(leftQuery)) {
        queryList.add(leftQuery);
    }
    if (!StringUtil.isEmpty(rightQuery)) {
        queryList.add(rightQuery);
    }
    QueryTunerJob job = new QueryTunerJob(IQueryJob.RUN_PLAN | IQueryJob.COLLECT_STAT | IQueryJob.AUTO_COMMIT, database.getDatabaseInfo(), queryList, new TextRecordProcessor(), QueryTunerDialog.this);
    job.schedule();
    try {
        job.join();
        List<QueryRecord> queryRecordList = job.getQueryRecordList();
        QueryRecord leftRecord = null, rightRecord = null;
        if (queryRecordList.size() == 2) {
            leftRecord = queryRecordList.get(0);
            rightRecord = queryRecordList.get(1);
        } else if (queryRecordList.size() == 1) {
            if (!StringUtil.isEmpty(leftQuery)) {
                leftRecord = queryRecordList.get(0);
            } else {
                rightRecord = queryRecordList.get(0);
            }
        }
        displayComparePlan(leftRecord, rightRecord);
    } catch (InterruptedException e) {
        LOGGER.error(e.getMessage());
    }
    multiRunItem.setEnabled(true);
}
Also used : TextRecordProcessor(com.cubrid.common.ui.query.tuner.TextRecordProcessor) ArrayList(java.util.ArrayList) QueryTunerJob(com.cubrid.common.ui.query.tuner.QueryTunerJob) QueryRecord(com.cubrid.common.ui.query.tuner.QueryRecord)

Aggregations

QueryRecord (com.cubrid.common.ui.query.tuner.QueryRecord)3 QueryTunerJob (com.cubrid.common.ui.query.tuner.QueryTunerJob)3 TextRecordProcessor (com.cubrid.common.ui.query.tuner.TextRecordProcessor)3 ArrayList (java.util.ArrayList)3