1 21 22 package org.apache.derby.iapi.jdbc; 23 24 import java.sql.*; 25 import java.net.URL ; 26 27 30 public class BrokeredPreparedStatement30 extends BrokeredPreparedStatement { 31 32 private final Object generatedKeys; 33 public BrokeredPreparedStatement30(BrokeredStatementControl control, int jdbcLevel, String sql, Object generatedKeys) throws SQLException { 34 super(control, jdbcLevel, sql); 35 this.generatedKeys = generatedKeys; 36 } 37 38 public final void setURL(int i, URL x) 39 throws SQLException 40 { 41 getPreparedStatement().setURL( i, x); 42 } 43 public final ParameterMetaData getParameterMetaData() 44 throws SQLException 45 { 46 return getPreparedStatement().getParameterMetaData(); 47 } 48 51 public PreparedStatement createDuplicateStatement(Connection conn, PreparedStatement oldStatement) throws SQLException { 52 53 PreparedStatement newStatement; 54 55 if (generatedKeys == null) 56 newStatement = conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); 57 else { 58 if (generatedKeys instanceof Integer ) 61 newStatement = conn.prepareStatement(sql, ((Integer ) generatedKeys).intValue()); 62 else if (generatedKeys instanceof int[]) 63 newStatement = conn.prepareStatement(sql, (int[]) generatedKeys); 64 else 65 newStatement = conn.prepareStatement(sql, (String []) generatedKeys); 66 } 67 68 69 setStatementState(oldStatement, newStatement); 70 71 return newStatement; 72 } 73 } 74 | Popular Tags |