Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / impl / sql / execute / StatementTriggerExecutor.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/execute/StatementTriggerExecutor.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/execute/StatementTriggerExecutor.java
new file mode 100644 (file)
index 0000000..e84247f
--- /dev/null
@@ -0,0 +1,88 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.sql.execute.StatementTriggerExecutor\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;\r
+\r
+import org.apache.derby.iapi.sql.execute.CursorResultSet;\r
+import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;\r
+import org.apache.derby.iapi.error.StandardException;\r
+import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;\r
+\r
+import org.apache.derby.iapi.sql.Activation;\r
+\r
+/**\r
+ * A statement trigger executor is an object that executes\r
+ * a statement trigger.  It is instantiated at execution\r
+ * time.  There is one per statement trigger.\r
+ */\r
+public class StatementTriggerExecutor extends GenericTriggerExecutor\r
+{\r
+       /**\r
+        * Constructor\r
+        *\r
+        * @param tec the execution context\r
+        * @param triggerd the trigger descriptor\r
+        * @param activation the activation\r
+        * @param lcc the lcc\r
+        */\r
+       StatementTriggerExecutor\r
+       (\r
+               InternalTriggerExecutionContext tec, \r
+               TriggerDescriptor                               triggerd,\r
+               Activation                                              activation,\r
+               LanguageConnectionContext               lcc\r
+       )\r
+       {\r
+               super(tec, triggerd, activation, lcc);\r
+       }\r
+\r
+       /**\r
+        * Fire the trigger based on the event.\r
+        *\r
+        * @param event the trigger event\r
+        * @param brs   the before result set\r
+        * @param ars   the after result set\r
+        *\r
+        * @exception StandardException on error or general trigger\r
+        *      exception\r
+        */\r
+       void fireTrigger \r
+       (\r
+               TriggerEvent            event, \r
+               CursorResultSet         brs, \r
+               CursorResultSet         ars\r
+       ) throws StandardException\r
+       {\r
+               tec.setTrigger(triggerd);\r
+               tec.setBeforeResultSet(brs);\r
+               tec.setAfterResultSet(ars);\r
+               \r
+               try\r
+               {\r
+                       executeSPS(getAction());\r
+               }\r
+               finally\r
+               {\r
+                       clearSPS();\r
+                       tec.clearTrigger();     \r
+               }\r
+       }\r
+}\r