1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.sql.execute.CursorResultSet; 25 import org.apache.derby.iapi.error.StandardException; 26 import org.apache.derby.iapi.sql.dictionary.SPSDescriptor; 27 import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor; 28 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 29 import org.apache.derby.iapi.sql.Activation; 30 31 36 public class RowTriggerExecutor extends GenericTriggerExecutor 37 { 38 46 RowTriggerExecutor 47 ( 48 InternalTriggerExecutionContext tec, 49 TriggerDescriptor triggerd, 50 Activation activation, 51 LanguageConnectionContext lcc 52 ) 53 { 54 super(tec, triggerd, activation, lcc); 55 } 56 57 67 void fireTrigger 68 ( 69 TriggerEvent event, 70 CursorResultSet brs, 71 CursorResultSet ars 72 ) throws StandardException 73 { 74 tec.setTrigger(triggerd); 75 76 try 77 { 78 while (true) 79 { 80 if (brs != null) 81 { 82 if (brs.getNextRow() == null) 83 break; 84 } 85 86 if (ars != null) 87 { 88 if (ars.getNextRow() == null) 89 break; 90 } 91 92 tec.setBeforeResultSet(brs == null ? 93 null : 94 TemporaryRowHolderResultSet. 95 getNewRSOnCurrentRow(activation, brs)); 96 97 tec.setAfterResultSet(ars == null ? 98 null : 99 TemporaryRowHolderResultSet. 100 getNewRSOnCurrentRow(activation, ars)); 101 102 108 if (event.isAfter()) 109 tec.updateAICounters(); 110 111 executeSPS(getAction()); 112 113 118 if (event.isBefore()) 119 tec.updateAICounters(); 120 } 121 } 122 finally 123 { 124 clearSPS(); 125 tec.clearTrigger(); 126 } 127 } 128 } 129 | Popular Tags |