KickJava   Java API By Example, From Geeks To Geeks.

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


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

41 public class RealInsertVTIResultSetStatistics
42     extends RealNoRowsResultSetStatistics
43 {
44
45     /* Leave these fields public for object inspectors */
46     public int rowCount;
47     public boolean deferred;
48
49     // CONSTRUCTORS
50

51     /**
52      *
53      *
54      */

55     public RealInsertVTIResultSetStatistics(
56                                 int rowCount,
57                                 boolean deferred,
58                                 long executeTime,
59                                 ResultSetStatistics sourceResultSetStatistics
60                                 )
61     {
62         super(executeTime, sourceResultSetStatistics);
63         this.rowCount = rowCount;
64         this.deferred = deferred;
65         this.sourceResultSetStatistics = sourceResultSetStatistics;
66     }
67
68     // ResultSetStatistics interface
69

70     /**
71      * Return the statement execution plan as a String.
72      *
73      * @param depth Indentation level.
74      *
75      * @return String The statement execution plan as a String.
76      */

77     public String JavaDoc getStatementExecutionPlanText(int depth)
78     {
79         initFormatInfo(depth);
80
81         if (sourceResultSetStatistics == null)
82             return "";
83
84         return
85             indent + MessageService.getTextMessage(
86                                             SQLState.RTS_INSERT_VTI_RESULT_SET) +
87                     ":\n" +
88             indent + MessageService.getTextMessage(SQLState.RTS_DEFERRED) +
89                     ": " + deferred + "\n" +
90             indent + MessageService.getTextMessage(
91                                                 SQLState.RTS_ROWS_INSERTED) +
92                     " = " + rowCount + "\n" +
93             dumpTimeStats(indent) + ((sourceResultSetStatistics == null) ? "" :
94             sourceResultSetStatistics.getStatementExecutionPlanText(1));
95     }
96
97     /**
98      * Return information on the scan nodes from the statement execution
99      * plan as a String.
100      *
101      * @param depth Indentation level.
102      * @param tableName if not NULL then print information for this table only
103      *
104      * @return String The information on the scan nodes from the
105      * statement execution plan as a String.
106      */

107     public String JavaDoc getScanStatisticsText(String JavaDoc tableName, int depth)
108     {
109         return sourceResultSetStatistics.getScanStatisticsText(tableName, depth);
110     }
111  
112     // Class implementation
113

114     public String JavaDoc toString()
115     {
116         return getStatementExecutionPlanText(0);
117     }
118     /**
119    * Format for display, a name for this node.
120      *
121      */

122   public String JavaDoc getNodeName(){
123     return MessageService.getTextMessage(SQLState.RTS_INSERT_VTI);
124   }
125 }
126
Popular Tags