--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.sql.execute.rts.RealLastIndexKeyScanStatistics\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to you under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.sql.execute.rts;\r
+\r
+import org.apache.derby.iapi.services.io.StoredFormatIds;\r
+\r
+import org.apache.derby.iapi.services.i18n.MessageService;\r
+import org.apache.derby.iapi.reference.SQLState;\r
+\r
+import org.apache.derby.iapi.services.io.FormatableHashtable;\r
+import org.apache.derby.iapi.services.io.FormatableProperties;\r
+\r
+import java.io.ObjectOutput;\r
+import java.io.ObjectInput;\r
+import java.io.IOException;\r
+\r
+import java.util.Enumeration;\r
+import java.util.Properties;\r
+\r
+\r
+/**\r
+ ResultSetStatistics implemenation for RealLastIndexKeyScanResultSet.\r
+\r
+\r
+*/\r
+public class RealLastIndexKeyScanStatistics \r
+ extends RealNoPutResultSetStatistics\r
+{\r
+\r
+ /* Leave these fields public for object inspectors */\r
+ public String isolationLevel;\r
+ public String tableName;\r
+ public String indexName;\r
+ public String lockString;\r
+\r
+ // CONSTRUCTORS\r
+\r
+ /**\r
+ * \r
+ *\r
+ */\r
+ public RealLastIndexKeyScanStatistics(int numOpens,\r
+ long constructorTime,\r
+ long openTime,\r
+ long nextTime,\r
+ long closeTime,\r
+ int resultSetNumber,\r
+ String tableName,\r
+ String indexName,\r
+ String isolationLevel,\r
+ String lockString,\r
+ double optimizerEstimatedRowCount,\r
+ double optimizerEstimatedCost\r
+ )\r
+ {\r
+ super(\r
+ numOpens,\r
+ 1,\r
+ 0,\r
+ constructorTime,\r
+ openTime,\r
+ nextTime,\r
+ closeTime,\r
+ resultSetNumber,\r
+ optimizerEstimatedRowCount,\r
+ optimizerEstimatedCost\r
+ );\r
+ this.tableName = tableName;\r
+ this.indexName = indexName;\r
+ this.isolationLevel = isolationLevel;\r
+ this.lockString = lockString;\r
+ }\r
+\r
+ // ResultSetStatistics methods\r
+\r
+ /**\r
+ * Return the statement execution plan as a String.\r
+ *\r
+ * @param depth Indentation level.\r
+ *\r
+ * @return String The statement executio plan as a String.\r
+ */\r
+ public String getStatementExecutionPlanText(int depth)\r
+ {\r
+ String header;\r
+ String isolationString = null;\r
+\r
+ initFormatInfo(depth);\r
+\r
+ header =\r
+ indent + MessageService.getTextMessage(\r
+ SQLState.RTS_LKIS_RS,\r
+ tableName,\r
+ indexName);\r
+\r
+ header = header + MessageService.getTextMessage(\r
+ SQLState.RTS_LOCKING_OPTIMIZER,\r
+ isolationLevel,\r
+ lockString);\r
+\r
+ header = header + "\n";\r
+\r
+ return\r
+ header +\r
+ indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) +\r
+ " = " + numOpens + "\n" +\r
+ indent + MessageService.getTextMessage(SQLState.RTS_ROWS_SEEN) +\r
+ " = " + numOpens + "\n" +\r
+ dumpTimeStats(indent, subIndent) + "\n" +\r
+ ((rowsSeen > 0) \r
+ ?\r
+ subIndent + MessageService.getTextMessage(\r
+ SQLState.RTS_NEXT_TIME) +\r
+ " = " + (nextTime / numOpens) + "\n"\r
+ : \r
+ "") + "\n" +\r
+ // RESOLVE - estimated row count and cost will eventually \r
+ // be displayed for all nodes\r
+ dumpEstimatedCosts(subIndent);\r
+ }\r
+\r
+ /**\r
+ * Return information on the scan nodes from the statement execution \r
+ * plan as a String.\r
+ *\r
+ * @param depth Indentation level.\r
+ * @param tableName if not NULL then print information for this table only\r
+ *\r
+ * @return String The information on the scan nodes from the \r
+ * statement execution plan as a String.\r
+ */\r
+ public String getScanStatisticsText(String tableName, int depth)\r
+ {\r
+ if ((tableName == null) || (tableName.equals(this.tableName)))\r
+ return getStatementExecutionPlanText(depth);\r
+ else\r
+ return (String)"";\r
+ }\r
+\r
+ // Class implementation\r
+ \r
+ public String toString()\r
+ {\r
+ return getStatementExecutionPlanText(0);\r
+ }\r
+\r
+ /**\r
+ * Format for display, a name for this node.\r
+ *\r
+ */\r
+ public String getNodeName(){\r
+ return MessageService.getTextMessage(\r
+ indexName == null ?\r
+ SQLState.RTS_TABLE_SCAN :\r
+ SQLState.RTS_INDEX_SCAN);\r
+ }\r
+\r
+ /**\r
+ * If this node is on a database item (like a table or an index), then provide a\r
+ * string that describes the on item.\r
+ *\r
+ */\r
+ public String getNodeOn(){\r
+ if (indexName == null)\r
+ return MessageService.getTextMessage(SQLState.RTS_ON, tableName);\r
+ else\r
+ return MessageService.getTextMessage(\r
+ SQLState.RTS_ON_USING,\r
+ tableName,\r
+ indexName);\r
+ }\r
+}\r