KickJava   Java API By Example, From Geeks To Geeks.

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


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

41 public class RealRowResultSetStatistics
42     extends RealNoPutResultSetStatistics
43 {
44
45     /* Leave these fields public for object inspectors */
46     public int rowsReturned;
47
48     // CONSTRUCTORS
49
/**
50      *
51      *
52      */

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

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

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

117     public String JavaDoc getScanStatisticsText(String JavaDoc tableName, int depth)
118     {
119         return "";
120     }
121
122
123
124     // Class implementation
125

126     public String JavaDoc toString()
127     {
128         return getStatementExecutionPlanText(0);
129     }
130     /**
131    * Format for display, a name for this node.
132      *
133      */

134   public String JavaDoc getNodeName(){
135     return MessageService.getTextMessage(SQLState.RTS_ROW_RS);
136   }
137 }
138
Popular Tags