001: /*
002:
003: Derby - Class org.apache.derby.impl.sql.execute.rts.RealDeleteVTIResultSetStatistics
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.impl.sql.execute.rts;
023:
024: import org.apache.derby.iapi.services.i18n.MessageService;
025: import org.apache.derby.iapi.reference.SQLState;
026:
027: /**
028: ResultSetStatistics implemenation for DeleteVTIResultSet.
029:
030: @author jerry
031:
032: */
033: public class RealDeleteVTIResultSetStatistics extends
034: RealNoRowsResultSetStatistics {
035:
036: /* Leave these fields public for object inspectors */
037: public int rowCount;
038:
039: // CONSTRUCTORS
040:
041: /**
042: *
043: *
044: */
045: public RealDeleteVTIResultSetStatistics(int rowCount,
046: long executeTime,
047: ResultSetStatistics sourceResultSetStatistics) {
048: super (executeTime, sourceResultSetStatistics);
049: this .rowCount = rowCount;
050: this .sourceResultSetStatistics = sourceResultSetStatistics;
051: }
052:
053: // ResultSetStatistics interface
054:
055: /**
056: * Return the statement execution plan as a String.
057: *
058: * @param depth Indentation level.
059: *
060: * @return String The statement execution plan as a String.
061: */
062: public String getStatementExecutionPlanText(int depth) {
063: initFormatInfo(depth);
064:
065: return indent
066: + MessageService
067: .getTextMessage(SQLState.RTS_DELETE_VTI_RESULT_SET)
068: + ":\n"
069: + indent
070: + MessageService
071: .getTextMessage(SQLState.RTS_ROWS_DELETED)
072: + " = "
073: + rowCount
074: + "\n"
075: + dumpTimeStats(indent)
076: + ((sourceResultSetStatistics == null) ? ""
077: : sourceResultSetStatistics
078: .getStatementExecutionPlanText(1));
079: }
080:
081: /**
082: * Return information on the scan nodes from the statement execution
083: * plan as a String.
084: *
085: * @param depth Indentation level.
086: * @param tableName if not NULL then print information for this table only
087: *
088: * @return String The information on the scan nodes from the
089: * statement execution plan as a String.
090: */
091: public String getScanStatisticsText(String tableName, int depth) {
092: if (sourceResultSetStatistics == null)
093: return "";
094: return sourceResultSetStatistics.getScanStatisticsText(
095: tableName, depth);
096: }
097:
098: // Class implementation
099:
100: public String toString() {
101: return getStatementExecutionPlanText(0);
102: }
103:
104: /**
105: * Format for display, a name for this node.
106: *
107: */
108: public String getNodeName() {
109: return MessageService.getTextMessage(SQLState.RTS_DELETE_VTI);
110: }
111: }
|