rcrs.optimizerEstimatedCost,
getResultSetStatistics(rcrs.source) );
}
else if (rs instanceof SortResultSet)
{
SortResultSet srs = (SortResultSet) rs;
return new RealSortStatistics(
srs.numOpens,
srs.rowsSeen,
srs.rowsFiltered,
srs.constructorTime,
srs.openTime,
srs.nextTime,
srs.closeTime,
srs.resultSetNumber,
srs.rowsInput,
srs.rowsReturned,
srs.distinct,
srs.isInSortedOrder,
srs.sortProperties,
srs.optimizerEstimatedRowCount,
srs.optimizerEstimatedCost,
getResultSetStatistics(srs.source)
);
}
else if (rs instanceof DistinctScalarAggregateResultSet)
{
DistinctScalarAggregateResultSet dsars = (DistinctScalarAggregateResultSet) rs;
return new RealDistinctScalarAggregateStatistics(
dsars.numOpens,
dsars.rowsSeen,
dsars.rowsFiltered,
dsars.constructorTime,
dsars.openTime,
dsars.nextTime,
dsars.closeTime,
dsars.resultSetNumber,
dsars.rowsInput,
dsars.optimizerEstimatedRowCount,
dsars.optimizerEstimatedCost,
getResultSetStatistics(dsars.source)
);
}
else if (rs instanceof ScalarAggregateResultSet)
{
ScalarAggregateResultSet sars = (ScalarAggregateResultSet) rs;
return new RealScalarAggregateStatistics(
sars.numOpens,
sars.rowsSeen,
sars.rowsFiltered,
sars.constructorTime,
sars.openTime,
sars.nextTime,
sars.closeTime,
sars.resultSetNumber,
sars.singleInputRow,
sars.rowsInput,
sars.optimizerEstimatedRowCount,
sars.optimizerEstimatedCost,
getResultSetStatistics(sars.source)
);
}
else if (rs instanceof GroupedAggregateResultSet)
{
GroupedAggregateResultSet gars = (GroupedAggregateResultSet) rs;
return new RealGroupedAggregateStatistics(
gars.numOpens,
gars.rowsSeen,
gars.rowsFiltered,
gars.constructorTime,
gars.openTime,
gars.nextTime,
gars.closeTime,
gars.resultSetNumber,
gars.rowsInput,
gars.hasDistinctAggregate,
gars.isInSortedOrder,
gars.sortProperties,
gars.optimizerEstimatedRowCount,
gars.optimizerEstimatedCost,
getResultSetStatistics(gars.source)
);
}
else if (rs instanceof TableScanResultSet)
{
boolean instantaneousLocks = false;
TableScanResultSet tsrs = (TableScanResultSet) rs;
String startPosition = null;
String stopPosition = null;
String isolationLevel = null;
String lockString = null;
String lockRequestString = null;
switch (tsrs.isolationLevel)
{
case TransactionController.ISOLATION_SERIALIZABLE:
isolationLevel =
MessageService.getTextMessage(
SQLState.LANG_SERIALIZABLE);
break;
case TransactionController.ISOLATION_REPEATABLE_READ:
isolationLevel =
MessageService.getTextMessage(
SQLState.LANG_REPEATABLE_READ);
break;
case TransactionController.ISOLATION_READ_COMMITTED_NOHOLDLOCK:
instantaneousLocks = true;
//fall through
case TransactionController.ISOLATION_READ_COMMITTED:
isolationLevel = MessageService.getTextMessage(
SQLState.LANG_READ_COMMITTED);
break;
case TransactionController.ISOLATION_READ_UNCOMMITTED:
isolationLevel =
MessageService.getTextMessage(
SQLState.LANG_READ_UNCOMMITTED);
break;
}
if (tsrs.forUpdate)
{
lockString = MessageService.getTextMessage(
SQLState.LANG_EXCLUSIVE);
}
else
{
if (instantaneousLocks)
{
lockString = MessageService.getTextMessage(
SQLState.LANG_INSTANTANEOUS_SHARE);
}
else
{
lockString = MessageService.getTextMessage(
SQLState.LANG_SHARE);
}
}
switch (tsrs.lockMode)
{
case TransactionController.MODE_TABLE:
// RESOLVE: Not sure this will really work, as we
// are tacking together English words to make a phrase.
// Will this work in other languages?
lockRequestString = lockString + " " +
MessageService.getTextMessage(
SQLState.LANG_TABLE);
break;
case TransactionController.MODE_RECORD:
// RESOLVE: Not sure this will really work, as we
// are tacking together English words to make a phrase.
// Will this work in other languages?
lockRequestString = lockString + " " +
MessageService.getTextMessage(
SQLState.LANG_ROW);
break;
}
if (tsrs.indexName != null)
{
/* Start and stop position strings will be non-null
* if the TSRS has been closed. Otherwise, we go off
* and build the strings now.
*/
startPosition = tsrs.startPositionString;
if (startPosition == null)
{
startPosition = tsrs.printStartPosition();
}
stopPosition = tsrs.stopPositionString;
if (stopPosition == null)
{
stopPosition = tsrs.printStopPosition();
}
}
return new
RealTableScanStatistics(
tsrs.numOpens,
tsrs.rowsSeen,
tsrs.rowsFiltered,
tsrs.constructorTime,
tsrs.openTime,
tsrs.nextTime,
tsrs.closeTime,
tsrs.resultSetNumber,
tsrs.tableName,
tsrs.userSuppliedOptimizerOverrides,
tsrs.indexName,
tsrs.isConstraint,
tsrs.printQualifiers(tsrs.qualifiers),
tsrs.getScanProperties(),
startPosition,
stopPosition,
isolationLevel,
lockRequestString,
tsrs.rowsPerRead,
tsrs.coarserLock,
tsrs.optimizerEstimatedRowCount,
tsrs.optimizerEstimatedCost);
}
else if (rs instanceof LastIndexKeyResultSet )
{
LastIndexKeyResultSet lrs = (LastIndexKeyResultSet) rs;
String isolationLevel = null;
String lockRequestString = null;
switch (lrs.isolationLevel)
{
case TransactionController.ISOLATION_SERIALIZABLE:
isolationLevel =
MessageService.getTextMessage(
SQLState.LANG_SERIALIZABLE);
break;
case TransactionController.ISOLATION_REPEATABLE_READ:
isolationLevel =
MessageService.getTextMessage(
SQLState.LANG_REPEATABLE_READ);
break;
case TransactionController.ISOLATION_READ_COMMITTED_NOHOLDLOCK:
case TransactionController.ISOLATION_READ_COMMITTED:
isolationLevel = MessageService.getTextMessage(
SQLState.LANG_READ_COMMITTED);
break;
case TransactionController.ISOLATION_READ_UNCOMMITTED:
isolationLevel = MessageService.getTextMessage(
SQLState.LANG_READ_UNCOMMITTED);
break;
}
switch (lrs.lockMode)
{
case TransactionController.MODE_TABLE:
lockRequestString = MessageService.getTextMessage(
SQLState.LANG_SHARE_TABLE);
break;
case TransactionController.MODE_RECORD:
lockRequestString = MessageService.getTextMessage(
SQLState.LANG_SHARE_ROW);
break;
}
return new RealLastIndexKeyScanStatistics(
lrs.numOpens,
lrs.constructorTime,
lrs.openTime,
lrs.nextTime,
lrs.closeTime,
lrs.resultSetNumber,
lrs.tableName,
lrs.indexName,
isolationLevel,
lockRequestString,
lrs.optimizerEstimatedRowCount,
lrs.optimizerEstimatedCost);
}
else if (rs instanceof HashLeftOuterJoinResultSet)
{
HashLeftOuterJoinResultSet hlojrs =
(HashLeftOuterJoinResultSet) rs;
return new RealHashLeftOuterJoinStatistics(
hlojrs.numOpens,
hlojrs.rowsSeen,
hlojrs.rowsFiltered,
hlojrs.constructorTime,
hlojrs.openTime,
hlojrs.nextTime,
hlojrs.closeTime,
hlojrs.resultSetNumber,
hlojrs.rowsSeenLeft,
hlojrs.rowsSeenRight,
hlojrs.rowsReturned,
hlojrs.restrictionTime,
hlojrs.optimizerEstimatedRowCount,
hlojrs.optimizerEstimatedCost,
hlojrs.userSuppliedOptimizerOverrides,
getResultSetStatistics(
hlojrs.leftResultSet),
getResultSetStatistics(
hlojrs.rightResultSet),
hlojrs.emptyRightRowsReturned);
}
else if (rs instanceof NestedLoopLeftOuterJoinResultSet)
{
NestedLoopLeftOuterJoinResultSet nllojrs =
(NestedLoopLeftOuterJoinResultSet) rs;
return new RealNestedLoopLeftOuterJoinStatistics(
nllojrs.numOpens,
nllojrs.rowsSeen,
nllojrs.rowsFiltered,
nllojrs.constructorTime,
nllojrs.openTime,
nllojrs.nextTime,
nllojrs.closeTime,
nllojrs.resultSetNumber,
nllojrs.rowsSeenLeft,
nllojrs.rowsSeenRight,
nllojrs.rowsReturned,
nllojrs.restrictionTime,
nllojrs.optimizerEstimatedRowCount,
nllojrs.optimizerEstimatedCost,
nllojrs.userSuppliedOptimizerOverrides,
getResultSetStatistics(
nllojrs.leftResultSet),
getResultSetStatistics(
nllojrs.rightResultSet),
nllojrs.emptyRightRowsReturned);
}
else if (rs instanceof HashJoinResultSet)
{
HashJoinResultSet hjrs = (HashJoinResultSet) rs;
return new RealHashJoinStatistics(
hjrs.numOpens,
hjrs.rowsSeen,
hjrs.rowsFiltered,
hjrs.constructorTime,
hjrs.openTime,
hjrs.nextTime,
hjrs.closeTime,
hjrs.resultSetNumber,
hjrs.rowsSeenLeft,
hjrs.rowsSeenRight,
hjrs.rowsReturned,
hjrs.restrictionTime,
hjrs.oneRowRightSide,
hjrs.optimizerEstimatedRowCount,
hjrs.optimizerEstimatedCost,
hjrs.userSuppliedOptimizerOverrides,
getResultSetStatistics(
hjrs.leftResultSet),
getResultSetStatistics(
hjrs.rightResultSet)
);
}
else if (rs instanceof NestedLoopJoinResultSet)
{
NestedLoopJoinResultSet nljrs = (NestedLoopJoinResultSet) rs;
return new RealNestedLoopJoinStatistics(
nljrs.numOpens,
nljrs.rowsSeen,
nljrs.rowsFiltered,
nljrs.constructorTime,
nljrs.openTime,
nljrs.nextTime,
nljrs.closeTime,
nljrs.resultSetNumber,
nljrs.rowsSeenLeft,
nljrs.rowsSeenRight,
nljrs.rowsReturned,
nljrs.restrictionTime,
nljrs.oneRowRightSide,
nljrs.optimizerEstimatedRowCount,
nljrs.optimizerEstimatedCost,
nljrs.userSuppliedOptimizerOverrides,
getResultSetStatistics(
nljrs.leftResultSet),
getResultSetStatistics(
nljrs.rightResultSet)
);
}
else if (rs instanceof IndexRowToBaseRowResultSet)
{
IndexRowToBaseRowResultSet irtbrrs =
(IndexRowToBaseRowResultSet) rs;
return new RealIndexRowToBaseRowStatistics(
irtbrrs.numOpens,
irtbrrs.rowsSeen,
irtbrrs.rowsFiltered,
irtbrrs.constructorTime,
irtbrrs.openTime,
irtbrrs.nextTime,
irtbrrs.closeTime,
irtbrrs.resultSetNumber,
irtbrrs.indexName,
irtbrrs.accessedHeapCols,
irtbrrs.optimizerEstimatedRowCount,
irtbrrs.optimizerEstimatedCost,
getResultSetStatistics(
irtbrrs.source)
);
}
else if (rs instanceof WindowResultSet)
{
WindowResultSet wrs = (WindowResultSet) rs;
return new RealWindowResultSetStatistics(
wrs.numOpens,
wrs.rowsSeen,
wrs.rowsFiltered,
wrs.constructorTime,
wrs.openTime,
wrs.nextTime,
wrs.closeTime,
wrs.resultSetNumber,
wrs.optimizerEstimatedRowCount,
wrs.optimizerEstimatedCost,
getResultSetStatistics(wrs.source)
);
}
else if (rs instanceof RowResultSet)
{
RowResultSet rrs = (RowResultSet) rs;
return new RealRowResultSetStatistics(
rrs.numOpens,
rrs.rowsSeen,
rrs.rowsFiltered,
rrs.constructorTime,
rrs.openTime,
rrs.nextTime,
rrs.closeTime,
rrs.resultSetNumber,
rrs.rowsReturned,
rrs.optimizerEstimatedRowCount,
rrs.optimizerEstimatedCost);
}
else if (rs instanceof SetOpResultSet)
{
SetOpResultSet srs = (SetOpResultSet) rs;
return new RealSetOpResultSetStatistics(
srs.getOpType(),
srs.numOpens,
srs.rowsSeen,
srs.rowsFiltered,
srs.constructorTime,
srs.openTime,
srs.nextTime,
srs.closeTime,
srs.getResultSetNumber(),
srs.getRowsSeenLeft(),
srs.getRowsSeenRight(),
srs.getRowsReturned(),
srs.optimizerEstimatedRowCount,
srs.optimizerEstimatedCost,
getResultSetStatistics(srs.getLeftSourceInput()),
getResultSetStatistics(srs.getRightSourceInput())
);
}
else if (rs instanceof UnionResultSet)
{
UnionResultSet urs = (UnionResultSet)rs;