1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 26 import org.apache.derby.iapi.error.StandardException; 27 28 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 29 30 import org.apache.derby.iapi.sql.execute.ExecRow; 31 import org.apache.derby.iapi.sql.execute.NoPutResultSet; 32 33 import org.apache.derby.iapi.sql.Activation; 34 import org.apache.derby.iapi.sql.ResultDescription; 35 36 import org.apache.derby.iapi.store.access.TransactionController; 37 38 import java.sql.PreparedStatement ; 39 import java.sql.ResultSet ; 40 41 44 abstract class DMLVTIResultSet extends DMLWriteResultSet 45 { 46 47 49 NoPutResultSet sourceResultSet; 50 NoPutResultSet savedSource; 51 UpdatableVTIConstantAction constants; 52 TransactionController tc; 53 54 ResultDescription resultDescription; 55 private int numOpens; 56 boolean firstExecute; 57 58 62 public ResultDescription getResultDescription() 63 { 64 return resultDescription; 65 } 66 67 71 DMLVTIResultSet(NoPutResultSet source, 72 Activation activation) 73 throws StandardException 74 { 75 super(activation); 76 sourceResultSet = source; 77 constants = (UpdatableVTIConstantAction) constantAction; 78 79 tc = activation.getTransactionController(); 80 81 resultDescription = sourceResultSet.getResultDescription(); 82 } 83 84 87 public void open() throws StandardException 88 { 89 firstExecute = (numOpens == 0); 91 92 rowCount = 0; 93 94 if (numOpens++ == 0) 95 { 96 sourceResultSet.openCore(); 97 } 98 else 99 { 100 sourceResultSet.reopenCore(); 101 } 102 103 openCore(); 104 105 106 if (lcc.getRunTimeStatisticsMode()) 107 { 108 109 savedSource = sourceResultSet; 110 } 111 112 cleanUp(); 113 114 endTime = getCurrentTimeMillis(); 115 } 117 protected abstract void openCore() throws StandardException; 118 119 124 public void cleanUp() throws StandardException 125 { 126 127 if( null != sourceResultSet) 128 sourceResultSet.close(); 129 numOpens = 0; 130 super.close(); 131 } 133 public void finish() throws StandardException 134 { 135 136 sourceResultSet.finish(); 137 super.finish(); 138 } } 140 | Popular Tags |