KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > execute > rts > RealDeleteVTIResultSetStatistics


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.rts.RealDeleteVTIResultSetStatistics
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.sql.execute.rts;
23
24 import org.apache.derby.iapi.services.i18n.MessageService;
25 import org.apache.derby.iapi.reference.SQLState;
26
27 /**
28   ResultSetStatistics implemenation for DeleteVTIResultSet.
29
30   @author jerry
31
32 */

33 public class RealDeleteVTIResultSetStatistics
34     extends RealNoRowsResultSetStatistics
35 {
36
37     /* Leave these fields public for object inspectors */
38     public int rowCount;
39
40     // CONSTRUCTORS
41

42     /**
43      *
44      *
45      */

46     public RealDeleteVTIResultSetStatistics(
47                                 int rowCount,
48                                 long executeTime,
49                                 ResultSetStatistics sourceResultSetStatistics
50                                 )
51     {
52         super(executeTime, sourceResultSetStatistics);
53         this.rowCount = rowCount;
54         this.sourceResultSetStatistics = sourceResultSetStatistics;
55     }
56
57     // ResultSetStatistics interface
58

59     /**
60      * Return the statement execution plan as a String.
61      *
62      * @param depth Indentation level.
63      *
64      * @return String The statement execution plan as a String.
65      */

66     public String JavaDoc getStatementExecutionPlanText(int depth)
67     {
68         initFormatInfo(depth);
69
70
71         return
72             indent + MessageService.getTextMessage(SQLState.RTS_DELETE_VTI_RESULT_SET) +
73                     ":\n" +
74             indent + MessageService.getTextMessage(
75                                                 SQLState.RTS_ROWS_DELETED) +
76                     " = " + rowCount + "\n" +
77             dumpTimeStats(indent) + ((sourceResultSetStatistics == null) ? "" :
78             sourceResultSetStatistics.getStatementExecutionPlanText(1));
79     }
80
81     /**
82      * Return information on the scan nodes from the statement execution
83      * plan as a String.
84      *
85      * @param depth Indentation level.
86      * @param tableName if not NULL then print information for this table only
87      *
88      * @return String The information on the scan nodes from the
89      * statement execution plan as a String.
90      */

91     public String JavaDoc getScanStatisticsText(String JavaDoc tableName, int depth)
92     {
93         if (sourceResultSetStatistics == null)
94             return "";
95         return sourceResultSetStatistics.getScanStatisticsText(tableName, depth);
96     }
97  
98     // Class implementation
99

100     public String JavaDoc toString()
101     {
102         return getStatementExecutionPlanText(0);
103     }
104     /**
105    * Format for display, a name for this node.
106      *
107      */

108   public String JavaDoc getNodeName(){
109     return MessageService.getTextMessage(SQLState.RTS_DELETE_VTI);
110   }
111 }
112
Popular Tags