예제 #1
0
 private void fetchExecutionResult(
     @NotNull DBCSession session, @NotNull DBDDataReceiver dataReceiver, @NotNull SQLQuery query)
     throws DBCException {
   // Fetch fake result set
   // DBCStatement statsStatement;
   StatResultSet fakeResultSet = new StatResultSet(session, curStatement);
   SQLQueryResult resultInfo = new SQLQueryResult(query);
   if (statistics.getStatementsCount() > 1) {
     // Multiple statements - show script statistics
     fakeResultSet.addColumn("Queries", DBPDataKind.NUMERIC);
     fakeResultSet.addColumn("Updated Rows", DBPDataKind.NUMERIC);
     fakeResultSet.addColumn("Execute time", DBPDataKind.NUMERIC);
     fakeResultSet.addColumn("Fetch time", DBPDataKind.NUMERIC);
     fakeResultSet.addColumn("Total time", DBPDataKind.NUMERIC);
     fakeResultSet.addRow(
         statistics.getStatementsCount(),
         statistics.getRowsUpdated(),
         statistics.getExecuteTime(),
         statistics.getFetchTime(),
         statistics.getTotalTime());
     resultInfo.setResultSetName("Statistics");
   } else {
     // Single statement
     long updateCount = statistics.getRowsUpdated();
     if (updateCount >= 0) {
       fakeResultSet.addColumn("Query", DBPDataKind.STRING);
       fakeResultSet.addColumn("Updated Rows", DBPDataKind.NUMERIC);
       fakeResultSet.addRow(query.getQuery(), updateCount);
     } else {
       fakeResultSet.addColumn("Result", DBPDataKind.NUMERIC);
     }
     resultInfo.setResultSetName("Result");
   }
   fetchQueryData(session, fakeResultSet, resultInfo, dataReceiver, false);
 }
예제 #2
0
 private void showExecutionResult(DBCSession session) throws DBCException {
   if (statistics.getStatementsCount() > 1 || resultSetNumber == 0) {
     SQLQuery query = new SQLQuery("", -1, -1);
     if (queries.size() == 1) {
       query.setQuery(queries.get(0).getQuery());
     }
     query.setData(STATS_RESULTS); // It will set tab name to "Stats"
     DBDDataReceiver dataReceiver = resultsConsumer.getDataReceiver(query, resultSetNumber);
     if (dataReceiver != null) {
       fetchExecutionResult(session, dataReceiver, query);
     }
   }
 }