1 16 17 package org.apache.commons.dbcp; 18 19 import java.math.BigDecimal ; 20 import java.sql.Array ; 21 import java.sql.Blob ; 22 import java.sql.Clob ; 23 import java.sql.Connection ; 24 import java.sql.PreparedStatement ; 25 import java.sql.Ref ; 26 import java.sql.ResultSet ; 27 import java.sql.ResultSetMetaData ; 28 import java.sql.SQLException ; 29 import java.util.Calendar ; 30 31 38 public class TesterPreparedStatement extends TesterStatement implements PreparedStatement { 39 private ResultSetMetaData _resultSetMetaData = null; 40 private String _sql = null; 41 private String _catalog = null; 42 43 public TesterPreparedStatement(Connection conn) { 44 super(conn); 45 try { 46 _catalog = conn.getCatalog(); 47 } catch (SQLException e) { } 48 } 49 50 public TesterPreparedStatement(Connection conn, String sql) { 51 super(conn); 52 _sql = sql; 53 try { 54 _catalog = conn.getCatalog(); 55 } catch (SQLException e) { } 56 } 57 58 public TesterPreparedStatement(Connection conn, String sql, int resultSetType, int resultSetConcurrency) { 59 super(conn, resultSetType, resultSetConcurrency); 60 _sql = sql; 61 try { 62 _catalog = conn.getCatalog(); 63 } catch (SQLException e) { } 64 } 65 66 67 public String getCatalog() { 68 return _catalog; 69 } 70 71 public ResultSet executeQuery(String sql) throws SQLException { 72 checkOpen(); 73 if("null".equals(sql)) { 74 return null; 75 } else { 76 return new TesterResultSet(this, null, _resultSetType, _resultSetConcurrency); 77 } 78 } 79 80 public int executeUpdate(String sql) throws SQLException { 81 checkOpen(); 82 return _rowsUpdated; 83 } 84 85 public ResultSet executeQuery() throws SQLException { 86 checkOpen(); 87 if("null".equals(_sql)) { 88 return null; 89 } else { 90 return new TesterResultSet(this, null, _resultSetType, _resultSetConcurrency); 91 } 92 } 93 94 public int executeUpdate() throws SQLException { 95 checkOpen(); 96 return _rowsUpdated; 97 } 98 99 public void setNull(int parameterIndex, int sqlType) throws SQLException { 100 checkOpen(); 101 } 102 103 public void setBoolean(int parameterIndex, boolean x) throws SQLException { 104 checkOpen(); 105 } 106 107 public void setByte(int parameterIndex, byte x) throws SQLException { 108 checkOpen(); 109 } 110 111 public void setShort(int parameterIndex, short x) throws SQLException { 112 checkOpen(); 113 } 114 115 public void setInt(int parameterIndex, int x) throws SQLException { 116 checkOpen(); 117 } 118 119 public void setLong(int parameterIndex, long x) throws SQLException { 120 checkOpen(); 121 } 122 123 public void setFloat(int parameterIndex, float x) throws SQLException { 124 checkOpen(); 125 } 126 127 public void setDouble(int parameterIndex, double x) throws SQLException { 128 checkOpen(); 129 } 130 131 public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { 132 checkOpen(); 133 } 134 135 public void setString(int parameterIndex, String x) throws SQLException { 136 checkOpen(); 137 } 138 139 public void setBytes(int parameterIndex, byte x[]) throws SQLException { 140 checkOpen(); 141 } 142 143 public void setDate(int parameterIndex, java.sql.Date x) throws SQLException { 144 checkOpen(); 145 } 146 147 public void setTime(int parameterIndex, java.sql.Time x) throws SQLException { 148 checkOpen(); 149 } 150 151 public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException { 152 checkOpen(); 153 } 154 155 public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { 156 checkOpen(); 157 } 158 159 160 public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { 161 checkOpen(); 162 } 163 164 public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { 165 checkOpen(); 166 } 167 168 public void clearParameters() throws SQLException { 169 checkOpen(); 170 } 171 172 public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { 173 checkOpen(); 174 } 175 176 public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { 177 checkOpen(); 178 } 179 180 public void setObject(int parameterIndex, Object x) throws SQLException { 181 checkOpen(); 182 } 183 184 185 public boolean execute() throws SQLException { 186 checkOpen(); return true; 187 } 188 189 public void addBatch() throws SQLException { 190 checkOpen(); 191 } 192 193 public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws SQLException { 194 checkOpen(); 195 } 196 197 public void setRef (int i, Ref x) throws SQLException { 198 checkOpen(); 199 } 200 201 public void setBlob (int i, Blob x) throws SQLException { 202 checkOpen(); 203 } 204 205 public void setClob (int i, Clob x) throws SQLException { 206 checkOpen(); 207 } 208 209 public void setArray (int i, Array x) throws SQLException { 210 checkOpen(); 211 } 212 213 public ResultSetMetaData getMetaData() throws SQLException { 214 checkOpen(); 215 return _resultSetMetaData; 216 } 217 218 public void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws SQLException { 219 checkOpen(); 220 } 221 222 public void setTime(int parameterIndex, java.sql.Time x, Calendar cal) throws SQLException { 223 checkOpen(); 224 } 225 226 public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) throws SQLException { 227 checkOpen(); 228 } 229 230 public void setNull (int paramIndex, int sqlType, String typeName) throws SQLException { 231 checkOpen(); 232 } 233 234 235 238 239 240 public boolean getMoreResults(int current) throws SQLException { 241 throw new SQLException ("Not implemented."); 242 } 243 244 public ResultSet getGeneratedKeys() throws SQLException { 245 throw new SQLException ("Not implemented."); 246 } 247 248 public int executeUpdate(String sql, int autoGeneratedKeys) 249 throws SQLException { 250 throw new SQLException ("Not implemented."); 251 } 252 253 public int executeUpdate(String sql, int columnIndexes[]) 254 throws SQLException { 255 throw new SQLException ("Not implemented."); 256 } 257 258 public int executeUpdate(String sql, String columnNames[]) 259 throws SQLException { 260 throw new SQLException ("Not implemented."); 261 } 262 263 public boolean execute(String sql, int autoGeneratedKeys) 264 throws SQLException { 265 throw new SQLException ("Not implemented."); 266 } 267 268 public boolean execute(String sl, int columnIndexes[]) 269 throws SQLException { 270 throw new SQLException ("Not implemented."); 271 } 272 273 public boolean execute(String sql, String columnNames[]) 274 throws SQLException { 275 throw new SQLException ("Not implemented."); 276 } 277 278 public int getResultSetHoldability() throws SQLException { 279 throw new SQLException ("Not implemented."); 280 } 281 282 public void setURL(int parameterIndex, java.net.URL x) 283 throws SQLException { 284 throw new SQLException ("Not implemented."); 285 } 286 287 public java.sql.ParameterMetaData getParameterMetaData() throws SQLException { 288 throw new SQLException ("Not implemented."); 289 } 290 291 292 293 } 294 | Popular Tags |