use of org.apache.derby.impl.sql.execute.InsertVTIResultSet 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;
}
Aggregations