KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.rts.RealVTIStatistics
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.io.StoredFormatIds;
25
26 import org.apache.derby.iapi.services.i18n.MessageService;
27 import org.apache.derby.iapi.reference.SQLState;
28
29 import org.apache.derby.iapi.services.io.FormatableHashtable;
30
31 import java.io.ObjectOutput JavaDoc;
32 import java.io.ObjectInput JavaDoc;
33 import java.io.IOException JavaDoc;
34
35
36 /**
37   ResultSetStatistics implemenation for VTIResultSet.
38
39   @author jerry
40
41 */

42 public class RealVTIStatistics
43     extends RealNoPutResultSetStatistics
44 {
45
46
47     /* Leave these fields public for object inspectors */
48     public String JavaDoc javaClassName;
49
50     // CONSTRUCTORS
51
/**
52      *
53      *
54      */

55     public RealVTIStatistics(
56                                 int numOpens,
57                                 int rowsSeen,
58                                 int rowsFiltered,
59                                 long constructorTime,
60                                 long openTime,
61                                 long nextTime,
62                                 long closeTime,
63                                 int resultSetNumber,
64                                 String JavaDoc javaClassName,
65                                 double optimizerEstimatedRowCount,
66                                 double optimizerEstimatedCost
67                                 )
68     {
69         super(
70             numOpens,
71             rowsSeen,
72             rowsFiltered,
73             constructorTime,
74             openTime,
75             nextTime,
76             closeTime,
77             resultSetNumber,
78             optimizerEstimatedRowCount,
79             optimizerEstimatedCost
80             );
81         this.javaClassName = javaClassName;
82     }
83
84     // ResultSetStatistics methods
85

86     /**
87      * Return the statement execution plan as a String.
88      *
89      * @param depth Indentation level.
90      *
91      * @return String The statement executio plan as a String.
92      */

93     public String JavaDoc getStatementExecutionPlanText(int depth)
94     {
95         String JavaDoc header;
96
97         initFormatInfo(depth);
98
99         header = indent + MessageService.getTextMessage(
100                                                 SQLState.RTS_VTI_RS,
101                                                 javaClassName) +
102                     ":\n";
103
104         return
105             header +
106             indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) +
107                 " = " + numOpens + "\n" +
108             indent + MessageService.getTextMessage(SQLState.RTS_ROWS_SEEN) +
109                 " = " + rowsSeen + "\n" +
110             dumpTimeStats(indent, subIndent) + "\n" +
111             dumpEstimatedCosts(subIndent);
112     }
113
114     /**
115      * Return information on the scan nodes from the statement execution
116      * plan as a String.
117      *
118      * @param depth Indentation level.
119      * @param tableName if not NULL then print information for this table only
120      *
121      * @return String The information on the scan nodes from the
122      * statement execution plan as a String.
123      */

124     public String JavaDoc getScanStatisticsText(String JavaDoc tableName, int depth)
125     {
126         return getStatementExecutionPlanText(depth);
127     }
128
129     // Class implementation
130

131     public String JavaDoc toString()
132     {
133         return getStatementExecutionPlanText(0);
134     }
135
136     /**
137      * If this node is on a database item (like a table or an index), then provide a
138    * string that describes the on item.
139    *
140      */

141   public String JavaDoc getNodeOn(){
142     return MessageService.getTextMessage(
143                                             SQLState.RTS_ON,
144                                             javaClassName);
145   }
146     /**
147    * Format for display, a name for this node.
148      *
149      */

150   public String JavaDoc getNodeName(){
151     return MessageService.getTextMessage(SQLState.RTS_VTI);
152   }
153 }
154
Popular Tags