KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.rts.RealNormalizeResultSetStatistics
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   ResultSetStatistics implemenation for NormalizeResultSet.
37
38   @author jerry
39
40 */

41 public class RealNormalizeResultSetStatistics
42     extends RealNoPutResultSetStatistics
43 {
44
45     /* Leave these fields public for object inspectors */
46     public ResultSetStatistics childResultSetStatistics;
47
48     // CONSTRUCTORS
49

50     /**
51      *
52      *
53      */

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

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

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

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

130     public String JavaDoc toString()
131     {
132         return getStatementExecutionPlanText(0);
133     }
134   public java.util.Vector JavaDoc getChildren(){
135     java.util.Vector JavaDoc children = new java.util.Vector JavaDoc();
136     children.addElement(childResultSetStatistics);
137     return children;
138   }
139     /**
140    * Format for display, a name for this node.
141      *
142      */

143   public String JavaDoc getNodeName(){
144     return MessageService.getTextMessage(SQLState.RTS_NORMALIZE_RS);
145   }
146 }
147
Popular Tags