KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.rts.RealDeleteResultSetStatistics
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 DeleteResultSet.
29
30   @author jerry
31
32 */

33 public class RealDeleteResultSetStatistics
34     extends RealNoRowsResultSetStatistics
35 {
36
37     /* Leave these fields public for object inspectors */
38     public int rowCount;
39     public boolean deferred;
40     public boolean tableLock;
41     public int indexesUpdated;
42
43     // CONSTRUCTORS
44
/**
45      *
46      *
47      */

48     public RealDeleteResultSetStatistics(
49                                 int rowCount,
50                                 boolean deferred,
51                                 int indexesUpdated,
52                                 boolean tableLock,
53                                 long executeTime,
54                                 ResultSetStatistics sourceResultSetStatistics
55                                 )
56     {
57         super(executeTime, sourceResultSetStatistics);
58         this.rowCount = rowCount;
59         this.deferred = deferred;
60         this.indexesUpdated = indexesUpdated;
61         this.tableLock = tableLock;
62         this.sourceResultSetStatistics = sourceResultSetStatistics;
63     }
64
65     // ResultSetStatistics interface
66

67     /**
68      * Return the statement execution plan as a String.
69      *
70      * @param depth Indentation level.
71      *
72      * @return String The statement execution plan as a String.
73      */

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

109     public String JavaDoc getScanStatisticsText(String JavaDoc tableName, int depth)
110     {
111         if (sourceResultSetStatistics == null)
112             return "";
113         
114         return sourceResultSetStatistics.getScanStatisticsText(tableName, depth);
115     }
116
117     // Class implementation
118

119     public String JavaDoc toString()
120     {
121         return getStatementExecutionPlanText(0);
122     }
123     /**
124    * Format for display, a name for this node.
125      *
126      */

127   public String JavaDoc getNodeName(){
128     return MessageService.getTextMessage(SQLState.RTS_DELETE);
129   }
130 }
131
Popular Tags