);
}
else if (rs instanceof HashScanResultSet)
{
boolean instantaneousLocks = false;
HashScanResultSet hsrs = (HashScanResultSet) rs;
String startPosition = null;
String stopPosition = null;
String isolationLevel = null;
String lockString = null;
switch (hsrs.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;
}
if (hsrs.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 (hsrs.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?
lockString = 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?
lockString = lockString + " " +
MessageService.getTextMessage(
SQLState.LANG_ROW);
break;
}
if (hsrs.indexName != null)
{
/* Start and stop position strings will be non-null
* if the HSRS has been closed. Otherwise, we go off
* and build the strings now.
*/
startPosition = hsrs.startPositionString;
if (startPosition == null)
{
startPosition = hsrs.printStartPosition();
}
stopPosition = hsrs.stopPositionString;
if (stopPosition == null)
{
stopPosition = hsrs.printStopPosition();
}
}
// DistinctScanResultSet is simple sub-class of
// HashScanResultSet
if (rs instanceof DistinctScanResultSet)
{
return new RealDistinctScanStatistics(
hsrs.numOpens,
hsrs.rowsSeen,
hsrs.rowsFiltered,
hsrs.constructorTime,
hsrs.openTime,
hsrs.nextTime,
hsrs.closeTime,
hsrs.resultSetNumber,
hsrs.tableName,
hsrs.indexName,
hsrs.isConstraint,
hsrs.hashtableSize,
hsrs.keyColumns,
hsrs.printQualifiers(
hsrs.scanQualifiers),
hsrs.printQualifiers(
hsrs.nextQualifiers),
hsrs.getScanProperties(),
startPosition,
stopPosition,
isolationLevel,
lockString,
hsrs.optimizerEstimatedRowCount,
hsrs.optimizerEstimatedCost
);
}
else
{
return new RealHashScanStatistics(
hsrs.numOpens,
hsrs.rowsSeen,
hsrs.rowsFiltered,
hsrs.constructorTime,
hsrs.openTime,
hsrs.nextTime,
hsrs.closeTime,
hsrs.resultSetNumber,
hsrs.tableName,
hsrs.indexName,
hsrs.isConstraint,
hsrs.hashtableSize,
hsrs.keyColumns,
hsrs.printQualifiers(
hsrs.scanQualifiers),
hsrs.printQualifiers(
hsrs.nextQualifiers),
hsrs.getScanProperties(),
startPosition,
stopPosition,
isolationLevel,
lockString,
hsrs.optimizerEstimatedRowCount,