1 21 package org.apache.derby.client.net; 22 23 import org.apache.derby.client.am.ColumnMetaData; 24 import org.apache.derby.client.am.PreparedStatement; 25 import org.apache.derby.client.am.Section; 26 import org.apache.derby.client.am.SqlException; 27 import org.apache.derby.jdbc.ClientDriver; 28 import org.apache.derby.client.am.ClientJDBCObjectFactory; 29 import org.apache.derby.client.ClientPooledConnection; 30 31 32 public class NetPreparedStatement extends NetStatement 33 implements org.apache.derby.client.am.MaterialPreparedStatement { 34 35 37 org.apache.derby.client.am.PreparedStatement preparedStatement_; 38 39 40 NetPreparedStatement(org.apache.derby.client.am.PreparedStatement statement, 42 NetAgent netAgent, 43 NetConnection netConnection) { 44 super(statement, netAgent, netConnection); 45 initNetPreparedStatement(statement); 46 } 47 48 void resetNetPreparedStatement(org.apache.derby.client.am.PreparedStatement statement, 49 NetAgent netAgent, 50 NetConnection netConnection) { 51 super.resetNetStatement(statement, netAgent, netConnection); 52 initNetPreparedStatement(statement); 53 } 54 55 private void initNetPreparedStatement(org.apache.derby.client.am.PreparedStatement statement) { 56 preparedStatement_ = statement; 57 preparedStatement_.materialPreparedStatement_ = this; 58 } 59 60 91 NetPreparedStatement(NetAgent netAgent, NetConnection netConnection, String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String [] columnNames, ClientPooledConnection cpc) throws SqlException { 92 this(ClientDriver.getFactory().newPreparedStatement(netAgent, 93 netConnection, sql, type, concurrency, holdability, 94 autoGeneratedKeys, columnNames, cpc), 95 netAgent, 96 netConnection 97 ); 98 } 99 100 void resetNetPreparedStatement(NetAgent netAgent, NetConnection netConnection, String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String [] columnNames) throws SqlException { 101 preparedStatement_.resetPreparedStatement(netAgent, netConnection, sql, type, concurrency, holdability, autoGeneratedKeys, columnNames); 102 resetNetPreparedStatement(preparedStatement_, netAgent, netConnection); 103 } 104 105 127 NetPreparedStatement(NetAgent netAgent, 128 NetConnection netConnection, 129 String sql, 130 Section section,ClientPooledConnection cpc) 131 throws SqlException { 132 this(ClientDriver.getFactory().newPreparedStatement(netAgent, 133 netConnection, sql, section,cpc), 134 netAgent, 135 netConnection); 136 } 137 138 void resetNetPreparedStatement(NetAgent netAgent, 139 NetConnection netConnection, 140 String sql, 141 Section section) throws SqlException { 142 preparedStatement_.resetPreparedStatement(netAgent, netConnection, sql, section); 143 resetNetPreparedStatement(preparedStatement_, netAgent, netConnection); 144 } 145 146 void resetNetPreparedStatement(NetAgent netAgent, 147 NetConnection netConnection, 148 String sql, 149 Section section, 150 ColumnMetaData parameterMetaData, 151 ColumnMetaData resultSetMetaData) throws SqlException { 152 preparedStatement_.resetPreparedStatement(netAgent, netConnection, sql, section, parameterMetaData, resultSetMetaData); 153 this.resetNetPreparedStatement(preparedStatement_, netAgent, netConnection); 154 } 155 156 protected void finalize() throws java.lang.Throwable { 157 super.finalize(); 158 } 159 160 public void writeExecute_(Section section, 161 ColumnMetaData parameterMetaData, 162 Object [] inputs, 163 int numInputColumns, 164 boolean outputExpected, 165 boolean chainedWritesFollowingSetLob) throws SqlException { 172 netAgent_.statementRequest_.writeExecute(this, 173 section, 174 parameterMetaData, 175 inputs, 176 numInputColumns, 177 outputExpected, 178 chainedWritesFollowingSetLob); 179 } 180 181 182 public void readExecute_() throws SqlException { 183 netAgent_.statementReply_.readExecute(preparedStatement_); 184 } 185 186 public void writeOpenQuery_(Section section, 187 int fetchSize, 188 int resultSetType, 189 int numInputColumns, 190 ColumnMetaData parameterMetaData, 191 Object [] inputs) throws SqlException { 192 netAgent_.statementRequest_.writeOpenQuery(this, 193 section, 194 fetchSize, 195 resultSetType, 196 numInputColumns, 197 parameterMetaData, 198 inputs); 199 } 200 202 public void writeDescribeInput_(Section section) throws SqlException { 203 netAgent_.statementRequest_.writeDescribeInput(this, section); 204 } 205 206 public void readDescribeInput_() throws SqlException { 207 netAgent_.statementReply_.readDescribeInput(preparedStatement_); 208 } 209 210 public void writeDescribeOutput_(Section section) throws SqlException { 211 netAgent_.statementRequest_.writeDescribeOutput(this, section); 212 } 213 214 public void readDescribeOutput_() throws SqlException { 215 netAgent_.statementReply_.readDescribeOutput(preparedStatement_); 216 } 217 } 218 | Popular Tags |