Search in sources :

Example 1 with RunTimeStatisticsImpl

use of org.apache.derby.impl.sql.execute.rts.RunTimeStatisticsImpl in project derby by apache.

the class RealResultSetStatisticsFactory method getRunTimeStatistics.

// 
// ExecutionFactory interface
// 
// 
// ResultSetStatisticsFactory interface
// 
/**
 *		@see ResultSetStatisticsFactory#getRunTimeStatistics
 */
public RunTimeStatistics getRunTimeStatistics(Activation activation, ResultSet rs, NoPutResultSet[] subqueryTrackingArray) throws StandardException {
    PreparedStatement preStmt = activation.getPreparedStatement();
    // In this case statistics should not be generated.
    if (preStmt == null)
        return null;
    ResultSetStatistics topResultSetStatistics;
    if (rs instanceof NoPutResultSet) {
        topResultSetStatistics = getResultSetStatistics((NoPutResultSet) rs);
    } else {
        topResultSetStatistics = getResultSetStatistics(rs);
    }
    /* Build up the info on the materialized subqueries */
    int subqueryTrackingArrayLength = (subqueryTrackingArray == null) ? 0 : subqueryTrackingArray.length;
    ResultSetStatistics[] subqueryRSS = new ResultSetStatistics[subqueryTrackingArrayLength];
    boolean anyAttached = false;
    for (int index = 0; index < subqueryTrackingArrayLength; index++) {
        if (subqueryTrackingArray[index] != null && subqueryTrackingArray[index].getPointOfAttachment() == -1) {
            subqueryRSS[index] = getResultSetStatistics(subqueryTrackingArray[index]);
            anyAttached = true;
        }
    }
    if (anyAttached == false) {
        subqueryRSS = null;
    }
    // Get the info on all of the materialized subqueries (attachment point = -1)
    return new RunTimeStatisticsImpl(preStmt.getSPSName(), activation.getCursorName(), preStmt.getSource(), preStmt.getCompileTimeInMillis(), preStmt.getParseTimeInMillis(), preStmt.getBindTimeInMillis(), preStmt.getOptimizeTimeInMillis(), preStmt.getGenerateTimeInMillis(), rs.getExecuteTime(), preStmt.getBeginCompileTimestamp(), preStmt.getEndCompileTimestamp(), rs.getBeginExecutionTimestamp(), rs.getEndExecutionTimestamp(), subqueryRSS, topResultSetStatistics);
}
Also used : ResultSetStatistics(org.apache.derby.iapi.sql.execute.ResultSetStatistics) RealUpdateResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealUpdateResultSetStatistics) RealDeleteResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealDeleteResultSetStatistics) RealDeleteVTIResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealDeleteVTIResultSetStatistics) RealAnyResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealAnyResultSetStatistics) RealScrollInsensitiveResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealScrollInsensitiveResultSetStatistics) RealRowResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealRowResultSetStatistics) RealMaterializedResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealMaterializedResultSetStatistics) RealNormalizeResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealNormalizeResultSetStatistics) RealUnionResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealUnionResultSetStatistics) RealOnceResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealOnceResultSetStatistics) RealInsertResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealInsertResultSetStatistics) RealJoinResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealJoinResultSetStatistics) RealWindowResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealWindowResultSetStatistics) RealSetOpResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealSetOpResultSetStatistics) RealInsertVTIResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealInsertVTIResultSetStatistics) RealDeleteCascadeResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealDeleteCascadeResultSetStatistics) NoPutResultSet(org.apache.derby.iapi.sql.execute.NoPutResultSet) PreparedStatement(org.apache.derby.iapi.sql.PreparedStatement) RunTimeStatisticsImpl(org.apache.derby.impl.sql.execute.rts.RunTimeStatisticsImpl)

Aggregations

PreparedStatement (org.apache.derby.iapi.sql.PreparedStatement)1 NoPutResultSet (org.apache.derby.iapi.sql.execute.NoPutResultSet)1 ResultSetStatistics (org.apache.derby.iapi.sql.execute.ResultSetStatistics)1 RealAnyResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealAnyResultSetStatistics)1 RealDeleteCascadeResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealDeleteCascadeResultSetStatistics)1 RealDeleteResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealDeleteResultSetStatistics)1 RealDeleteVTIResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealDeleteVTIResultSetStatistics)1 RealInsertResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealInsertResultSetStatistics)1 RealInsertVTIResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealInsertVTIResultSetStatistics)1 RealJoinResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealJoinResultSetStatistics)1 RealMaterializedResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealMaterializedResultSetStatistics)1 RealNormalizeResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealNormalizeResultSetStatistics)1 RealOnceResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealOnceResultSetStatistics)1 RealRowResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealRowResultSetStatistics)1 RealScrollInsensitiveResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealScrollInsensitiveResultSetStatistics)1 RealSetOpResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealSetOpResultSetStatistics)1 RealUnionResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealUnionResultSetStatistics)1 RealUpdateResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealUpdateResultSetStatistics)1 RealWindowResultSetStatistics (org.apache.derby.impl.sql.execute.rts.RealWindowResultSetStatistics)1 RunTimeStatisticsImpl (org.apache.derby.impl.sql.execute.rts.RunTimeStatisticsImpl)1