| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
package org.apache.commons.dbcp; |
| 19 | |
|
| 20 | |
import java.math.BigDecimal; |
| 21 | |
import java.sql.Array; |
| 22 | |
import java.sql.Blob; |
| 23 | |
import java.sql.Clob; |
| 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 | |
import java.io.InputStream; |
| 32 | |
import java.io.Reader; |
| 33 | |
import java.sql.NClob; |
| 34 | |
import java.sql.RowId; |
| 35 | |
import java.sql.SQLXML; |
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
public class DelegatingPreparedStatement extends DelegatingStatement |
| 58 | |
implements PreparedStatement { |
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
public DelegatingPreparedStatement(DelegatingConnection c, |
| 69 | |
PreparedStatement s) { |
| 70 | 30659 | super(c, s); |
| 71 | 30659 | } |
| 72 | |
|
| 73 | |
public boolean equals(Object obj) { |
| 74 | 33627 | PreparedStatement delegate = (PreparedStatement) getInnermostDelegate(); |
| 75 | 33627 | if (delegate == null) { |
| 76 | 6 | return false; |
| 77 | |
} |
| 78 | 33621 | if (obj instanceof DelegatingPreparedStatement) { |
| 79 | 33615 | DelegatingPreparedStatement s = (DelegatingPreparedStatement) obj; |
| 80 | 33615 | return delegate.equals(s.getInnermostDelegate()); |
| 81 | |
} |
| 82 | |
else { |
| 83 | 6 | return delegate.equals(obj); |
| 84 | |
} |
| 85 | |
} |
| 86 | |
|
| 87 | |
|
| 88 | |
public void setDelegate(PreparedStatement s) { |
| 89 | 0 | super.setDelegate(s); |
| 90 | 0 | _stmt = s; |
| 91 | 0 | } |
| 92 | |
|
| 93 | |
public ResultSet executeQuery() throws SQLException { |
| 94 | 33467 | checkOpen(); |
| 95 | |
try { |
| 96 | 33467 | return DelegatingResultSet.wrapResultSet(this,((PreparedStatement)_stmt).executeQuery()); |
| 97 | |
} |
| 98 | 0 | catch (SQLException e) { |
| 99 | 0 | handleException(e); |
| 100 | 0 | throw new AssertionError(); |
| 101 | |
} |
| 102 | |
} |
| 103 | |
|
| 104 | |
public int executeUpdate() throws SQLException |
| 105 | 0 | { checkOpen(); try { return ((PreparedStatement)_stmt).executeUpdate(); } catch (SQLException e) { handleException(e); return 0; } } |
| 106 | |
|
| 107 | |
public void setNull(int parameterIndex, int sqlType) throws SQLException |
| 108 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setNull(parameterIndex,sqlType); } catch (SQLException e) { handleException(e); } } |
| 109 | |
|
| 110 | |
public void setBoolean(int parameterIndex, boolean x) throws SQLException |
| 111 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setBoolean(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 112 | |
|
| 113 | |
public void setByte(int parameterIndex, byte x) throws SQLException |
| 114 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setByte(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 115 | |
|
| 116 | |
public void setShort(int parameterIndex, short x) throws SQLException |
| 117 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setShort(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 118 | |
|
| 119 | |
public void setInt(int parameterIndex, int x) throws SQLException |
| 120 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setInt(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 121 | |
|
| 122 | |
public void setLong(int parameterIndex, long x) throws SQLException |
| 123 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setLong(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 124 | |
|
| 125 | |
public void setFloat(int parameterIndex, float x) throws SQLException |
| 126 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setFloat(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 127 | |
|
| 128 | |
public void setDouble(int parameterIndex, double x) throws SQLException |
| 129 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setDouble(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 130 | |
|
| 131 | |
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException |
| 132 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setBigDecimal(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 133 | |
|
| 134 | |
public void setString(int parameterIndex, String x) throws SQLException |
| 135 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setString(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 136 | |
|
| 137 | |
public void setBytes(int parameterIndex, byte[] x) throws SQLException |
| 138 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setBytes(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 139 | |
|
| 140 | |
public void setDate(int parameterIndex, java.sql.Date x) throws SQLException |
| 141 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setDate(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 142 | |
|
| 143 | |
public void setTime(int parameterIndex, java.sql.Time x) throws SQLException |
| 144 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setTime(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 145 | |
|
| 146 | |
public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException |
| 147 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setTimestamp(parameterIndex,x); } catch (SQLException e) { handleException(e); } } |
| 148 | |
|
| 149 | |
public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException |
| 150 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setAsciiStream(parameterIndex,x,length); } catch (SQLException e) { handleException(e); } } |
| 151 | |
|
| 152 | |
|
| 153 | |
public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException |
| 154 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setUnicodeStream(parameterIndex,x,length); } catch (SQLException e) { handleException(e); } } |
| 155 | |
|
| 156 | |
public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException |
| 157 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setBinaryStream(parameterIndex,x,length); } catch (SQLException e) { handleException(e); } } |
| 158 | |
|
| 159 | |
public void clearParameters() throws SQLException |
| 160 | 3882 | { checkOpen(); try { ((PreparedStatement)_stmt).clearParameters(); } catch (SQLException e) { handleException(e); } } |
| 161 | |
|
| 162 | |
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException |
| 163 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setObject(parameterIndex, x, targetSqlType, scale); } catch (SQLException e) { handleException(e); } } |
| 164 | |
|
| 165 | |
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException |
| 166 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setObject(parameterIndex, x, targetSqlType); } catch (SQLException e) { handleException(e); } } |
| 167 | |
|
| 168 | |
public void setObject(int parameterIndex, Object x) throws SQLException |
| 169 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setObject(parameterIndex, x); } catch (SQLException e) { handleException(e); } } |
| 170 | |
|
| 171 | |
public boolean execute() throws SQLException |
| 172 | 0 | { checkOpen(); try { return ((PreparedStatement)_stmt).execute(); } catch (SQLException e) { handleException(e); return false; } } |
| 173 | |
|
| 174 | |
public void addBatch() throws SQLException |
| 175 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).addBatch(); } catch (SQLException e) { handleException(e); } } |
| 176 | |
|
| 177 | |
public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws SQLException |
| 178 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setCharacterStream(parameterIndex,reader,length); } catch (SQLException e) { handleException(e); } } |
| 179 | |
|
| 180 | |
public void setRef(int i, Ref x) throws SQLException |
| 181 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setRef(i,x); } catch (SQLException e) { handleException(e); } } |
| 182 | |
|
| 183 | |
public void setBlob(int i, Blob x) throws SQLException |
| 184 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setBlob(i,x); } catch (SQLException e) { handleException(e); } } |
| 185 | |
|
| 186 | |
public void setClob(int i, Clob x) throws SQLException |
| 187 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setClob(i,x); } catch (SQLException e) { handleException(e); } } |
| 188 | |
|
| 189 | |
public void setArray(int i, Array x) throws SQLException |
| 190 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setArray(i,x); } catch (SQLException e) { handleException(e); } } |
| 191 | |
|
| 192 | |
public ResultSetMetaData getMetaData() throws SQLException |
| 193 | 0 | { checkOpen(); try { return ((PreparedStatement)_stmt).getMetaData(); } catch (SQLException e) { handleException(e); throw new AssertionError(); } } |
| 194 | |
|
| 195 | |
public void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws SQLException |
| 196 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setDate(parameterIndex,x,cal); } catch (SQLException e) { handleException(e); } } |
| 197 | |
|
| 198 | |
public void setTime(int parameterIndex, java.sql.Time x, Calendar cal) throws SQLException |
| 199 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setTime(parameterIndex,x,cal); } catch (SQLException e) { handleException(e); } } |
| 200 | |
|
| 201 | |
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) throws SQLException |
| 202 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setTimestamp(parameterIndex,x,cal); } catch (SQLException e) { handleException(e); } } |
| 203 | |
|
| 204 | |
public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException |
| 205 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setNull(paramIndex,sqlType,typeName); } catch (SQLException e) { handleException(e); } } |
| 206 | |
|
| 207 | |
|
| 208 | |
|
| 209 | |
|
| 210 | |
|
| 211 | |
|
| 212 | |
|
| 213 | |
public String toString() { |
| 214 | 750 | return _stmt.toString(); |
| 215 | |
} |
| 216 | |
|
| 217 | |
public void setURL(int parameterIndex, java.net.URL x) throws SQLException |
| 218 | 0 | { checkOpen(); try { ((PreparedStatement)_stmt).setURL(parameterIndex, x); } catch (SQLException e) { handleException(e); } } |
| 219 | |
|
| 220 | |
public java.sql.ParameterMetaData getParameterMetaData() throws SQLException |
| 221 | 0 | { checkOpen(); try { return ((PreparedStatement)_stmt).getParameterMetaData(); } catch (SQLException e) { handleException(e); throw new AssertionError(); } } |
| 222 | |
|
| 223 | |
|
| 224 | |
|
| 225 | |
public void setRowId(int parameterIndex, RowId value) throws SQLException { |
| 226 | 0 | checkOpen(); |
| 227 | |
try { |
| 228 | 0 | ((PreparedStatement)_stmt).setRowId(parameterIndex, value); |
| 229 | |
} |
| 230 | 0 | catch (SQLException e) { |
| 231 | 0 | handleException(e); |
| 232 | 0 | } |
| 233 | 0 | } |
| 234 | |
|
| 235 | |
public void setNString(int parameterIndex, String value) throws SQLException { |
| 236 | 0 | checkOpen(); |
| 237 | |
try { |
| 238 | 0 | ((PreparedStatement)_stmt).setNString(parameterIndex, value); |
| 239 | |
} |
| 240 | 0 | catch (SQLException e) { |
| 241 | 0 | handleException(e); |
| 242 | 0 | } |
| 243 | 0 | } |
| 244 | |
|
| 245 | |
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { |
| 246 | 0 | checkOpen(); |
| 247 | |
try { |
| 248 | 0 | ((PreparedStatement)_stmt).setNCharacterStream(parameterIndex, value, length); |
| 249 | |
} |
| 250 | 0 | catch (SQLException e) { |
| 251 | 0 | handleException(e); |
| 252 | 0 | } |
| 253 | 0 | } |
| 254 | |
|
| 255 | |
public void setNClob(int parameterIndex, NClob value) throws SQLException { |
| 256 | 0 | checkOpen(); |
| 257 | |
try { |
| 258 | 0 | ((PreparedStatement)_stmt).setNClob(parameterIndex, value); |
| 259 | |
} |
| 260 | 0 | catch (SQLException e) { |
| 261 | 0 | handleException(e); |
| 262 | 0 | } |
| 263 | 0 | } |
| 264 | |
|
| 265 | |
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { |
| 266 | 0 | checkOpen(); |
| 267 | |
try { |
| 268 | 0 | ((PreparedStatement)_stmt).setClob(parameterIndex, reader, length); |
| 269 | |
} |
| 270 | 0 | catch (SQLException e) { |
| 271 | 0 | handleException(e); |
| 272 | 0 | } |
| 273 | 0 | } |
| 274 | |
|
| 275 | |
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { |
| 276 | 0 | checkOpen(); |
| 277 | |
try { |
| 278 | 0 | ((PreparedStatement)_stmt).setBlob(parameterIndex, inputStream, length); |
| 279 | |
} |
| 280 | 0 | catch (SQLException e) { |
| 281 | 0 | handleException(e); |
| 282 | 0 | } |
| 283 | 0 | } |
| 284 | |
|
| 285 | |
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { |
| 286 | 0 | checkOpen(); |
| 287 | |
try { |
| 288 | 0 | ((PreparedStatement)_stmt).setNClob(parameterIndex, reader, length); |
| 289 | |
} |
| 290 | 0 | catch (SQLException e) { |
| 291 | 0 | handleException(e); |
| 292 | 0 | } |
| 293 | 0 | } |
| 294 | |
|
| 295 | |
public void setSQLXML(int parameterIndex, SQLXML value) throws SQLException { |
| 296 | 0 | checkOpen(); |
| 297 | |
try { |
| 298 | 0 | ((PreparedStatement)_stmt).setSQLXML(parameterIndex, value); |
| 299 | |
} |
| 300 | 0 | catch (SQLException e) { |
| 301 | 0 | handleException(e); |
| 302 | 0 | } |
| 303 | 0 | } |
| 304 | |
|
| 305 | |
public void setAsciiStream(int parameterIndex, InputStream inputStream, long length) throws SQLException { |
| 306 | 0 | checkOpen(); |
| 307 | |
try { |
| 308 | 0 | ((PreparedStatement)_stmt).setAsciiStream(parameterIndex, inputStream, length); |
| 309 | |
} |
| 310 | 0 | catch (SQLException e) { |
| 311 | 0 | handleException(e); |
| 312 | 0 | } |
| 313 | 0 | } |
| 314 | |
|
| 315 | |
public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException { |
| 316 | 0 | checkOpen(); |
| 317 | |
try { |
| 318 | 0 | ((PreparedStatement)_stmt).setBinaryStream(parameterIndex, inputStream, length); |
| 319 | |
} |
| 320 | 0 | catch (SQLException e) { |
| 321 | 0 | handleException(e); |
| 322 | 0 | } |
| 323 | 0 | } |
| 324 | |
|
| 325 | |
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { |
| 326 | 0 | checkOpen(); |
| 327 | |
try { |
| 328 | 0 | ((PreparedStatement)_stmt).setCharacterStream(parameterIndex, reader, length); |
| 329 | |
} |
| 330 | 0 | catch (SQLException e) { |
| 331 | 0 | handleException(e); |
| 332 | 0 | } |
| 333 | 0 | } |
| 334 | |
|
| 335 | |
public void setAsciiStream(int parameterIndex, InputStream inputStream) throws SQLException { |
| 336 | 0 | checkOpen(); |
| 337 | |
try { |
| 338 | 0 | ((PreparedStatement)_stmt).setAsciiStream(parameterIndex, inputStream); |
| 339 | |
} |
| 340 | 0 | catch (SQLException e) { |
| 341 | 0 | handleException(e); |
| 342 | 0 | } |
| 343 | 0 | } |
| 344 | |
|
| 345 | |
public void setBinaryStream(int parameterIndex, InputStream inputStream) throws SQLException { |
| 346 | 0 | checkOpen(); |
| 347 | |
try { |
| 348 | 0 | ((PreparedStatement)_stmt).setBinaryStream(parameterIndex, inputStream); |
| 349 | |
} |
| 350 | 0 | catch (SQLException e) { |
| 351 | 0 | handleException(e); |
| 352 | 0 | } |
| 353 | 0 | } |
| 354 | |
|
| 355 | |
public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { |
| 356 | 0 | checkOpen(); |
| 357 | |
try { |
| 358 | 0 | ((PreparedStatement)_stmt).setCharacterStream(parameterIndex, reader); |
| 359 | |
} |
| 360 | 0 | catch (SQLException e) { |
| 361 | 0 | handleException(e); |
| 362 | 0 | } |
| 363 | 0 | } |
| 364 | |
|
| 365 | |
public void setNCharacterStream(int parameterIndex, Reader reader) throws SQLException { |
| 366 | 0 | checkOpen(); |
| 367 | |
try { |
| 368 | 0 | ((PreparedStatement)_stmt).setNCharacterStream(parameterIndex, reader); |
| 369 | |
} |
| 370 | 0 | catch (SQLException e) { |
| 371 | 0 | handleException(e); |
| 372 | 0 | } |
| 373 | 0 | } |
| 374 | |
|
| 375 | |
public void setClob(int parameterIndex, Reader reader) throws SQLException { |
| 376 | 0 | checkOpen(); |
| 377 | |
try { |
| 378 | 0 | ((PreparedStatement)_stmt).setClob(parameterIndex, reader); |
| 379 | |
} |
| 380 | 0 | catch (SQLException e) { |
| 381 | 0 | handleException(e); |
| 382 | 0 | } |
| 383 | 0 | } |
| 384 | |
|
| 385 | |
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { |
| 386 | 0 | checkOpen(); |
| 387 | |
try { |
| 388 | 0 | ((PreparedStatement)_stmt).setBlob(parameterIndex, inputStream); |
| 389 | |
} |
| 390 | 0 | catch (SQLException e) { |
| 391 | 0 | handleException(e); |
| 392 | 0 | } |
| 393 | 0 | } |
| 394 | |
|
| 395 | |
public void setNClob(int parameterIndex, Reader reader) throws SQLException { |
| 396 | 0 | checkOpen(); |
| 397 | |
try { |
| 398 | 0 | ((PreparedStatement)_stmt).setNClob(parameterIndex, reader); |
| 399 | |
} |
| 400 | 0 | catch (SQLException e) { |
| 401 | 0 | handleException(e); |
| 402 | 0 | } |
| 403 | 0 | } |
| 404 | |
|
| 405 | |
} |