Search in sources :

Example 1 with DeleteResultSet

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

the class RealResultSetStatisticsFactory method getNoRowsResultSetStatistics.

public ResultSetStatistics getNoRowsResultSetStatistics(ResultSet rs) {
    ResultSetStatistics retval = null;
    /* We need to differentiate based on instanceof in order
		 * to find the right constructor to call.  This is ugly,
		 * but if we don't do instanceof then rs is always seen as an
		 * interface instead of a class when we try to overload 
		 * a method with both.
		 */
    if (rs instanceof InsertResultSet) {
        InsertResultSet irs = (InsertResultSet) rs;
        retval = new RealInsertResultSetStatistics((int) irs.rowCount, irs.constants.deferred, irs.constants.irgs.length, irs.userSpecifiedBulkInsert, irs.bulkInsertPerformed, irs.constants.lockMode == TransactionController.MODE_TABLE, irs.getExecuteTime(), getResultSetStatistics(irs.savedSource));
        irs.savedSource = null;
    } else if (rs instanceof InsertVTIResultSet) {
        InsertVTIResultSet iVTIrs = (InsertVTIResultSet) rs;
        retval = new RealInsertVTIResultSetStatistics((int) iVTIrs.rowCount, iVTIrs.constants.deferred, iVTIrs.getExecuteTime(), getResultSetStatistics(iVTIrs.savedSource));
        iVTIrs.savedSource = null;
    } else if (rs instanceof UpdateResultSet) {
        UpdateResultSet urs = (UpdateResultSet) rs;
        retval = new RealUpdateResultSetStatistics((int) urs.rowCount, urs.constants.deferred, urs.constants.irgs.length, urs.constants.lockMode == TransactionController.MODE_TABLE, urs.getExecuteTime(), getResultSetStatistics(urs.savedSource));
        urs.savedSource = null;
    } else if (rs instanceof DeleteCascadeResultSet) {
        DeleteCascadeResultSet dcrs = (DeleteCascadeResultSet) rs;
        int dependentTrackingArrayLength = (dcrs.dependentResultSets == null) ? 0 : dcrs.dependentResultSets.length;
        ResultSetStatistics[] dependentTrackingArray = new ResultSetStatistics[dependentTrackingArrayLength];
        boolean anyAttached = false;
        for (int index = 0; index < dependentTrackingArrayLength; index++) {
            if (dcrs.dependentResultSets[index] != null) {
                dependentTrackingArray[index] = getResultSetStatistics(dcrs.dependentResultSets[index]);
                anyAttached = true;
            }
        }
        if (!anyAttached) {
            dependentTrackingArray = null;
        }
        retval = new RealDeleteCascadeResultSetStatistics((int) dcrs.rowCount, dcrs.constants.deferred, dcrs.constants.irgs.length, dcrs.constants.lockMode == TransactionController.MODE_TABLE, dcrs.getExecuteTime(), getResultSetStatistics(dcrs.savedSource), dependentTrackingArray);
        dcrs.savedSource = null;
    } else if (rs instanceof DeleteResultSet) {
        DeleteResultSet drs = (DeleteResultSet) rs;
        retval = new RealDeleteResultSetStatistics((int) drs.rowCount, drs.constants.deferred, drs.constants.irgs.length, drs.constants.lockMode == TransactionController.MODE_TABLE, drs.getExecuteTime(), getResultSetStatistics(drs.savedSource));
        drs.savedSource = null;
    } else if (rs instanceof DeleteVTIResultSet) {
        DeleteVTIResultSet dVTIrs = (DeleteVTIResultSet) rs;
        retval = new RealDeleteVTIResultSetStatistics((int) dVTIrs.rowCount, dVTIrs.getExecuteTime(), getResultSetStatistics(dVTIrs.savedSource));
        dVTIrs.savedSource = null;
    }
    return retval;
}
Also used : InsertResultSet(org.apache.derby.impl.sql.execute.InsertResultSet) 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) DeleteResultSet(org.apache.derby.impl.sql.execute.DeleteResultSet) UpdateResultSet(org.apache.derby.impl.sql.execute.UpdateResultSet) RealDeleteVTIResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealDeleteVTIResultSetStatistics) DeleteCascadeResultSet(org.apache.derby.impl.sql.execute.DeleteCascadeResultSet) InsertVTIResultSet(org.apache.derby.impl.sql.execute.InsertVTIResultSet) RealUpdateResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealUpdateResultSetStatistics) RealInsertVTIResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealInsertVTIResultSetStatistics) DeleteVTIResultSet(org.apache.derby.impl.sql.execute.DeleteVTIResultSet) RealDeleteCascadeResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealDeleteCascadeResultSetStatistics) RealDeleteResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealDeleteResultSetStatistics) RealInsertResultSetStatistics(org.apache.derby.impl.sql.execute.rts.RealInsertResultSetStatistics)

Aggregations

ResultSetStatistics (org.apache.derby.iapi.sql.execute.ResultSetStatistics)1 DeleteCascadeResultSet (org.apache.derby.impl.sql.execute.DeleteCascadeResultSet)1 DeleteResultSet (org.apache.derby.impl.sql.execute.DeleteResultSet)1 DeleteVTIResultSet (org.apache.derby.impl.sql.execute.DeleteVTIResultSet)1 InsertResultSet (org.apache.derby.impl.sql.execute.InsertResultSet)1 InsertVTIResultSet (org.apache.derby.impl.sql.execute.InsertVTIResultSet)1 UpdateResultSet (org.apache.derby.impl.sql.execute.UpdateResultSet)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