Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / impl / sql / execute / rts / RealDeleteResultSetStatistics.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/execute/rts/RealDeleteResultSetStatistics.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/execute/rts/RealDeleteResultSetStatistics.java
new file mode 100644 (file)
index 0000000..12d48c7
--- /dev/null
@@ -0,0 +1,129 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.sql.execute.rts.RealDeleteResultSetStatistics\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.i18n.MessageService;\r
+import org.apache.derby.iapi.reference.SQLState;\r
+\r
+/**\r
+  ResultSetStatistics implemenation for DeleteResultSet.\r
+\r
+\r
+*/\r
+public class RealDeleteResultSetStatistics \r
+       extends RealNoRowsResultSetStatistics\r
+{\r
+\r
+       /* Leave these fields public for object inspectors */\r
+    public     int                                     rowCount;\r
+       public  boolean                                 deferred;\r
+       public  boolean                                 tableLock;\r
+       public  int                                             indexesUpdated;\r
+\r
+       // CONSTRUCTORS\r
+       /**\r
+        * \r
+        *\r
+        */\r
+    public     RealDeleteResultSetStatistics(\r
+                                                               int rowCount,\r
+                                                               boolean deferred,\r
+                                                               int indexesUpdated,\r
+                                                               boolean tableLock,\r
+                                                               long executeTime,\r
+                                                               ResultSetStatistics sourceResultSetStatistics\r
+                                                               )\r
+       {\r
+               super(executeTime, sourceResultSetStatistics);\r
+               this.rowCount = rowCount;\r
+               this.deferred = deferred;\r
+               this.indexesUpdated = indexesUpdated;\r
+               this.tableLock = tableLock;\r
+               this.sourceResultSetStatistics = sourceResultSetStatistics;\r
+       }\r
+\r
+       // ResultSetStatistics interface\r
+\r
+       /**\r
+        * Return the statement execution plan as a String.\r
+        *\r
+        * @param depth Indentation level.\r
+        *\r
+        * @return String       The statement execution plan as a String.\r
+        */\r
+       public String getStatementExecutionPlanText(int depth)\r
+       {\r
+\r
+               initFormatInfo(depth);\r
+\r
+\r
+               return\r
+                       indent +\r
+                         MessageService.getTextMessage(SQLState.RTS_DELETE_RS_USING) +\r
+                               " " +\r
+                               MessageService.getTextMessage(\r
+                                       ((tableLock) ?\r
+                                               SQLState.RTS_TABLE_LOCKING : SQLState.RTS_ROW_LOCKING))\r
+                               + ":\n" +\r
+                       indent + MessageService.getTextMessage(SQLState.RTS_DEFERRED) +\r
+                               ": " + deferred + "\n" + \r
+                       indent +\r
+                               MessageService.getTextMessage(SQLState.RTS_ROWS_DELETED) +\r
+                               " = " + rowCount + "\n" +\r
+                       indent +\r
+                               MessageService.getTextMessage(SQLState.RTS_INDEXES_UPDATED) +\r
+                               " = " + indexesUpdated + "\n" + \r
+                       dumpTimeStats(indent) + ((sourceResultSetStatistics == null) ? "" :\r
+                       sourceResultSetStatistics.getStatementExecutionPlanText(1));\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
+        * @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 (sourceResultSetStatistics == null)\r
+                       return "";\r
+               \r
+               return sourceResultSetStatistics.getScanStatisticsText(tableName, depth);\r
+       }\r
+\r
+       // Class implementation\r
+       \r
+       public String toString()\r
+       {\r
+               return getStatementExecutionPlanText(0);\r
+       }\r
+       /**\r
+   * Format for display, a name for this node.\r
+        *\r
+        */\r
+  public String getNodeName(){\r
+    return MessageService.getTextMessage(SQLState.RTS_DELETE);\r
+  }\r
+}\r