| 1 | | | |
| 2 | | | |
| 3 | | | |
| 4 | | | |
| 5 | | | |
| 6 | | | |
| 7 | | | |
| 8 | | | |
| 9 | | | |
| 10 | | | |
| 11 | | | |
| 12 | | | |
| 13 | | | |
| 14 | | | |
| 15 | | | |
| 16 | | | |
| 17 | | | |
| 18 | | | |
| 19 | | | |
| 20 | | | |
| 21 | | | |
| 22 | | | |
| 23 | | | |
| 24 | | | |
| 25 | | | |
| 26 | | | |
| 27 | | | |
| 28 | | | |
| 29 | | | |
| 30 | | | |
| 31 | | | |
| 32 | | | |
| 33 | | (1) | package org.jcoderz.commons.util; |
| 34 | | | |
| 35 | | | import java.io.InputStream; |
| 36 | | | import java.io.Reader; |
| 37 | | | import java.io.StringReader; |
| 38 | | | import java.math.BigDecimal; |
| 39 | | | import java.net.URL; |
| 40 | | | import java.sql.Array; |
| 41 | | | import java.sql.Blob; |
| 42 | | | import java.sql.Clob; |
| 43 | | | import java.sql.Connection; |
| 44 | | | import java.sql.Date; |
| 45 | | | import java.sql.Driver; |
| 46 | | | import java.sql.DriverManager; |
| 47 | | | import java.sql.ParameterMetaData; |
| 48 | | | import java.sql.PreparedStatement; |
| 49 | | | import java.sql.Ref; |
| 50 | | | import java.sql.ResultSet; |
| 51 | | | import java.sql.ResultSetMetaData; |
| 52 | | | import java.sql.SQLException; |
| 53 | | | import java.sql.SQLWarning; |
| 54 | | | import java.sql.Statement; |
| 55 | | | import java.sql.Time; |
| 56 | | | import java.sql.Timestamp; |
| 57 | | | import java.sql.Types; |
| 58 | | | import java.util.ArrayList; |
| 59 | | | import java.util.Calendar; |
| 60 | | | import java.util.Iterator; |
| 61 | | | import java.util.List; |
| 62 | | | import java.util.logging.Level; |
| 63 | | | import java.util.logging.Logger; |
| 64 | | | |
| 65 | | | |
| 66 | | | |
| 67 | | | |
| 68 | | | @author |
| 69 | | | |
| 70 | | | public final class DbUtil |
| 71 | | | { |
| 72 | | | |
| 73 | 75 | | private static final String CLASSNAME = DbUtil.class.getName(); |
| 74 | | | |
| 75 | | | |
| 76 | 100 | | private static final Logger logger = Logger.getLogger(CLASSNAME); |
| 77 | | | |
| 78 | | | |
| 79 | | | private static final String ORACLE_DRIVER_CLASSNAME |
| 80 | | | = "oracle.jdbc.OracleDriver"; |
| 81 | | | |
| 82 | | | |
| 83 | | | |
| 84 | | | private DbUtil () |
| 85 | 0 | | { |
| 86 | | | |
| 87 | 0 | | } |
| 88 | | | |
| 89 | | | |
| 90 | | | |
| 91 | | | @param |
| 92 | | | |
| 93 | | | public static void close (Statement stmt) |
| 94 | | | { |
| 95 | 100 | | if (stmt != null) |
| 96 | | | { |
| 97 | | | try |
| 98 | | | { |
| 99 | 100 | | stmt.close(); |
| 100 | | | } |
| 101 | 0 | | catch (SQLException x) |
| 102 | | | { |
| 103 | 0 | | logger.log(Level.FINE, "Error during resource cleanup: " |
| 104 | | | + "java.sql.Statement.close()", x); |
| 105 | 100 | | } |
| 106 | | | } |
| 107 | 100 | | } |
| 108 | | | |
| 109 | | | |
| 110 | | | |
| 111 | | | @param |
| 112 | | | |
| 113 | | | public static void close (Connection con) |
| 114 | | | { |
| 115 | 100 | | if (con != null) |
| 116 | | | { |
| 117 | | | try |
| 118 | | | { |
| 119 | 100 | | con.close(); |
| 120 | | | } |
| 121 | 0 | | catch (SQLException x) |
| 122 | | | { |
| 123 | 0 | | logger.log(Level.FINE, "Error during resource cleanup: " |
| 124 | | | + "java.sql.Connection.close()", x); |
| 125 | 100 | | } |
| 126 | | | } |
| 127 | 100 | | } |
| 128 | | | |
| 129 | | | |
| 130 | | | |
| 131 | | | @param |
| 132 | | | |
| 133 | | | public static void close (ResultSet resultSet) |
| 134 | | | { |
| 135 | 100 | | if (resultSet != null) |
| 136 | | | { |
| 137 | | | try |
| 138 | | | { |
| 139 | 100 | | resultSet.close(); |
| 140 | | | } |
| 141 | 0 | | catch (SQLException x) |
| 142 | | | { |
| 143 | 0 | | logger.log(Level.FINE, "Error during resource cleanup: " |
| 144 | | | + "java.sql.ResultSet.close()", x); |
| 145 | 100 | | } |
| 146 | | | } |
| 147 | 100 | | } |
| 148 | | | |
| 149 | | | |
| 150 | | | |
| 151 | | | |
| 152 | | | @param |
| 153 | | | @param |
| 154 | | | @param |
| 155 | | | @throws |
| 156 | | | |
| 157 | | | public static void setVarcharOrNull ( |
| 158 | | | PreparedStatement pstmt, int paramIndex, String value) |
| 159 | | | throws SQLException |
| 160 | | | { |
| 161 | 100 | | setParameterOrNull(pstmt, paramIndex, value, Types.VARCHAR); |
| 162 | 100 | | } |
| 163 | | | |
| 164 | | | |
| 165 | | | |
| 166 | | | |
| 167 | | | @param |
| 168 | | | @param |
| 169 | | | @param |
| 170 | | | @throws |
| 171 | | | |
| 172 | | | public static void setCharOrNull ( |
| 173 | | | PreparedStatement pstmt, int paramIndex, String value) |
| 174 | | | throws SQLException |
| 175 | | | { |
| 176 | 100 | | setParameterOrNull(pstmt, paramIndex, value, Types.CHAR); |
| 177 | 100 | | } |
| 178 | | | |
| 179 | | | |
| 180 | | | |
| 181 | | | |
| 182 | | | @param |
| 183 | | | @param |
| 184 | | | @param |
| 185 | | | @throws |
| 186 | | | |
| 187 | | | public static void setClobOrNull ( |
| 188 | | | PreparedStatement pstmt, int paramIndex, String value) |
| 189 | | | throws SQLException |
| 190 | | | { |
| 191 | 100 | | setParameterOrNull(pstmt, paramIndex, value, Types.CLOB); |
| 192 | 100 | | } |
| 193 | | | |
| 194 | | | |
| 195 | | | |
| 196 | | | |
| 197 | | | @param |
| 198 | | | @param |
| 199 | | | @param |
| 200 | | | @throws |
| 201 | | | |
| 202 | | | public static void setTimestampOrNull ( |
| 203 | | | PreparedStatement pstmt, int paramIndex, Timestamp value) |
| 204 | | | throws SQLException |
| 205 | | | { |
| 206 | 100 | | setParameterOrNull(pstmt, paramIndex, value, Types.TIMESTAMP); |
| 207 | 100 | | } |
| 208 | | | |
| 209 | | | |
| 210 | | | |
| 211 | | | |
| 212 | | | @param |
| 213 | | | @param |
| 214 | | | @param |
| 215 | | | @throws |
| 216 | | | |
| 217 | | | public static void setIntegerOrNull ( |
| 218 | | | PreparedStatement pstmt, int paramIndex, Integer value) |
| 219 | | | throws SQLException |
| 220 | | | { |
| 221 | 100 | | setParameterOrNull(pstmt, paramIndex, value, Types.INTEGER); |
| 222 | 100 | | } |
| 223 | | | |
| 224 | | | |
| 225 | | | |
| 226 | | | |
| 227 | | | @param |
| 228 | | | @param |
| 229 | | | @param |
| 230 | | | @throws |
| 231 | | | |
| 232 | | | public static void setLongOrNull ( |
| 233 | | | PreparedStatement pstmt, int paramIndex, Long value) |
| 234 | | | throws SQLException |
| 235 | | | { |
| 236 | | | |
| 237 | | | |
| 238 | | | |
| 239 | 100 | | if (value != null) |
| 240 | | | { |
| 241 | 100 | | pstmt.setLong(paramIndex, value.longValue()); |
| 242 | | | } |
| 243 | | | else |
| 244 | | | { |
| 245 | 100 | | pstmt.setNull(paramIndex, Types.INTEGER); |
| 246 | | | } |
| 247 | 100 | | } |
| 248 | | | |
| 249 | | | |
| 250 | | | |
| 251 | | | |
| 252 | | | |
| 253 | | | |
| 254 | | | |
| 255 | | | public static void registerOracleDriver () |
| 256 | | | { |
| 257 | | | try |
| 258 | | | { |
| 259 | 0 | | final Class driverClass |
| 260 | | | = Class.forName(ORACLE_DRIVER_CLASSNAME); |
| 261 | 0 | | final Driver driverObject = (Driver) driverClass.newInstance(); |
| 262 | 0 | | DriverManager.registerDriver(driverObject); |
| 263 | | | } |
| 264 | 0 | | catch (Exception e) |
| 265 | | | { |
| 266 | 0 | | final RuntimeException rte = new RuntimeException( |
| 267 | | | "Failed to register oracle driver " |
| 268 | | | + ORACLE_DRIVER_CLASSNAME, e); |
| 269 | 0 | | throw rte; |
| 270 | 0 | | } |
| 271 | 0 | | } |
| 272 | | | |
| 273 | | | |
| 274 | | | {@link } |
| 275 | | | <code></code> |
| 276 | | | <code></code> |
| 277 | | | <code></code> |
| 278 | | | |
| 279 | | | @param |
| 280 | | | @param |
| 281 | | | |
| 282 | | | @return |
| 283 | | | |
| 284 | | | |
| 285 | | | public static PreparedStatement getLimitedBatchSizePreparedStatement ( |
| 286 | | | PreparedStatement pstmt, int maxBatchSize) |
| 287 | | | { |
| 288 | 0 | (2) | return null; |
| 289 | | | } |
| 290 | | | |
| 291 | | | private static void setParameterOrNull ( |
| 292 | | | PreparedStatement pstmt, int paramIndex, Object value, int type) |
| 293 | | | throws SQLException |
| 294 | | | { |
| 295 | 100 | | if (value != null) |
| 296 | | | { |
| 297 | 100 | | switch (type) |
| 298 | | | { |
| 299 | | | case Types.VARCHAR: |
| 300 | | | case Types.CHAR: |
| 301 | 100 | | pstmt.setString(paramIndex, (String) value); |
| 302 | 100 | | break; |
| 303 | | | case Types.CLOB: |
| 304 | 100 | | final String strVal = (String) value; |
| 305 | 100 | | pstmt.setCharacterStream( |
| 306 | | | paramIndex, new StringReader(strVal), strVal.length()); |
| 307 | 100 | | break; |
| 308 | | | case Types.TIMESTAMP: |
| 309 | 100 | | final Timestamp tstampVal = (Timestamp) value; |
| 310 | 100 | | pstmt.setTimestamp(paramIndex, tstampVal); |
| 311 | 100 | | break; |
| 312 | | | case Types.INTEGER: |
| 313 | 100 | | final Integer intVal = (Integer) value; |
| 314 | 100 | | pstmt.setInt(paramIndex, intVal.intValue()); |
| 315 | 100 | | break; |
| 316 | | | default: |
| 317 | 50 | | throw new RuntimeException("Unexpected SQL type " |
| 318 | | | + type + " encountered"); |
| 319 | | | } |
| 320 | | | } |
| 321 | | | else |
| 322 | | | { |
| 323 | 100 | | pstmt.setNull(paramIndex, type); |
| 324 | | | } |
| 325 | 100 | | } |
| 326 | | | |
| 327 | | | private static final class LimitedBatchSizePreparedStatement |
| 328 | | (3) | |
| 329 | | | { |
| 330 | | | private final PreparedStatement mPreparedStatement; |
| 331 | | | private final int mMaxBatchSize; |
| 332 | 0 | | private final List mResultList = new ArrayList(); |
| 333 | | | |
| 334 | 0 | | private int mBatchCount = 0; |
| 335 | | | |
| 336 | | | private LimitedBatchSizePreparedStatement |
| 337 | | | (PreparedStatement pstmt, int maxBatchSize) |
| 338 | 0 | | { |
| 339 | 0 | | mPreparedStatement = pstmt; |
| 340 | 0 | | mMaxBatchSize = maxBatchSize; |
| 341 | 0 | | } |
| 342 | | | |
| 343 | | | {@inheritDoc} |
| 344 | | | public void addBatch () |
| 345 | | | throws SQLException |
| 346 | | | { |
| 347 | 0 | | if (mBatchCount >= mMaxBatchSize) |
| 348 | | | { |
| 349 | 0 | | internalExecuteBatch(); |
| 350 | | | } |
| 351 | 0 | | mPreparedStatement.addBatch(); |
| 352 | 0 | | mBatchCount++; |
| 353 | 0 | | } |
| 354 | | | |
| 355 | | | {@inheritDoc} |
| 356 | | | public void addBatch (String sql) |
| 357 | | | throws SQLException |
| 358 | | | { |
| 359 | 0 | | if (mBatchCount >= mMaxBatchSize) |
| 360 | | | { |
| 361 | 0 | | internalExecuteBatch(); |
| 362 | | | } |
| 363 | 0 | | mPreparedStatement.addBatch(sql); |
| 364 | 0 | | mBatchCount++; |
| 365 | 0 | | } |
| 366 | | | |
| 367 | | | {@inheritDoc} |
| 368 | | | public int[] executeBatch () |
| 369 | | | throws SQLException |
| 370 | | | { |
| 371 | 0 | | internalExecuteBatch(); |
| 372 | | | |
| 373 | 0 | | int totalBatchSize = 0; |
| 374 | 0 | | for (final Iterator it = mResultList.iterator(); it.hasNext(); ) |
| 375 | | | { |
| 376 | 0 | | final int[] updateResult = (int[]) it.next(); |
| 377 | 0 | | totalBatchSize += updateResult.length; |
| 378 | 0 | | } |
| 379 | | | |
| 380 | 0 | | final int[] result = new int[totalBatchSize]; |
| 381 | 0 | | int offset = 0; |
| 382 | 0 | | for (final Iterator it = mResultList.iterator(); it.hasNext(); ) |
| 383 | | | { |
| 384 | 0 | | final int[] updateResult = (int[]) it.next(); |
| 385 | 0 | | System.arraycopy( |
| 386 | | | updateResult, 0, result, offset, updateResult.length); |
| 387 | 0 | | offset += updateResult.length; |
| 388 | 0 | | } |
| 389 | 0 | | mResultList.clear(); |
| 390 | 0 | | return result; |
| 391 | | | } |
| 392 | | | |
| 393 | | | {@inheritDoc} |
| 394 | | | public void clearBatch () |
| 395 | | | throws SQLException |
| 396 | | | { |
| 397 | 0 | | mPreparedStatement.clearBatch(); |
| 398 | 0 | | mBatchCount = 0; |
| 399 | 0 | | mResultList.clear(); |
| 400 | 0 | | } |
| 401 | | | |
| 402 | | | {@inheritDoc} |
| 403 | | | public String toString () |
| 404 | | | { |
| 405 | 0 | | return "[LimitedBatchSizePreparedStatement: mBatchSize=" |
| 406 | | | + mMaxBatchSize + ", mPreparedStatement=" |
| 407 | | | + mPreparedStatement + "]"; |
| 408 | | | } |
| 409 | | | |
| 410 | | | private void internalExecuteBatch () |
| 411 | | | throws SQLException |
| 412 | | | { |
| 413 | 0 | | mBatchCount = 0; |
| 414 | 0 | | final int[] result = mPreparedStatement.executeBatch(); |
| 415 | 0 | | mResultList.add(result.clone()); |
| 416 | 0 | | } |
| 417 | | | |
| 418 | | | |
| 419 | | | |
| 420 | | | |
| 421 | | | |
| 422 | | | {@inheritDoc} |
| 423 | | | public void cancel () |
| 424 | | | throws SQLException |
| 425 | | | { |
| 426 | 0 | | mPreparedStatement.cancel(); |
| 427 | 0 | | } |
| 428 | | | |
| 429 | | | {@inheritDoc} |
| 430 | | | public void clearParameters () |
| 431 | | | throws SQLException |
| 432 | | | { |
| 433 | 0 | | mPreparedStatement.clearParameters(); |
| 434 | 0 | | } |
| 435 | | | |
| 436 | | | {@inheritDoc} |
| 437 | | | public void clearWarnings () |
| 438 | | | throws SQLException |
| 439 | | | { |
| 440 | 0 | | mPreparedStatement.clearWarnings(); |
| 441 | 0 | | } |
| 442 | | | |
| 443 | | | {@inheritDoc} |
| 444 | | | public void close () |
| 445 | | | throws SQLException |
| 446 | | | { |
| 447 | 0 | | mPreparedStatement.close(); |
| 448 | 0 | | } |
| 449 | | | |
| 450 | | | {@inheritDoc} |
| 451 | | | public boolean execute () |
| 452 | | | throws SQLException |
| 453 | | | { |
| 454 | 0 | | return mPreparedStatement.execute(); |
| 455 | | | } |
| 456 | | | |
| 457 | | | {@inheritDoc} |
| 458 | | | public boolean execute (String sql) |
| 459 | | | throws SQLException |
| 460 | | | { |
| 461 | 0 | | return mPreparedStatement.execute(sql); |
| 462 | | | } |
| 463 | | | |
| 464 | | | {@inheritDoc} |
| 465 | | | public boolean execute (String sql, int autoGeneratedKeys) |
| 466 | | | throws SQLException |
| 467 | | | { |
| 468 | 0 | | return mPreparedStatement.execute(sql, autoGeneratedKeys); |
| 469 | | | } |
| 470 | | | |
| 471 | | | {@inheritDoc} |
| 472 | | | public boolean execute (String sql, int[] columnIndexes) |
| 473 | | | throws SQLException |
| 474 | | | { |
| 475 | 0 | | return mPreparedStatement.execute(sql, columnIndexes); |
| 476 | | | } |
| 477 | | | |
| 478 | | | {@inheritDoc} |
| 479 | | | public boolean execute (String sql, String[] columnNames) |
| 480 | | | throws SQLException |
| 481 | | | { |
| 482 | 0 | | return mPreparedStatement.execute(sql, columnNames); |
| 483 | | | } |
| 484 | | | |
| 485 | | | {@inheritDoc} |
| 486 | | | public ResultSet executeQuery () |
| 487 | | | throws SQLException |
| 488 | | | { |
| 489 | 0 | | return mPreparedStatement.executeQuery(); |
| 490 | | | } |
| 491 | | | |
| 492 | | | {@inheritDoc} |
| 493 | | | public ResultSet executeQuery (String sql) |
| 494 | | | throws SQLException |
| 495 | | | { |
| 496 | 0 | | return mPreparedStatement.executeQuery(sql); |
| 497 | | | } |
| 498 | | | |
| 499 | | | {@inheritDoc} |
| 500 | | | public int executeUpdate () |
| 501 | | | throws SQLException |
| 502 | | | { |
| 503 | 0 | | return mPreparedStatement.executeUpdate(); |
| 504 | | | } |
| 505 | | | |
| 506 | | | {@inheritDoc} |
| 507 | | | public int executeUpdate (String sql) |
| 508 | | | throws SQLException |
| 509 | | | { |
| 510 | 0 | | return mPreparedStatement.executeUpdate(sql); |
| 511 | | | } |
| 512 | | | |
| 513 | | | {@inheritDoc} |
| 514 | | | public int executeUpdate (String sql, int autoGeneratedKeys) |
| 515 | | | throws SQLException |
| 516 | | | { |
| 517 | 0 | | return mPreparedStatement.executeUpdate(sql, autoGeneratedKeys); |
| 518 | | | } |
| 519 | | | |
| 520 | | | {@inheritDoc} |
| 521 | | | public int executeUpdate (String sql, int[] columnIndexes) |
| 522 | | | throws SQLException |
| 523 | | | { |
| 524 | 0 | | return mPreparedStatement.executeUpdate(sql, columnIndexes); |
| 525 | | | } |
| 526 | | | |
| 527 | | | {@inheritDoc} |
| 528 | | | public int executeUpdate (String sql, String[] columnNames) |
| 529 | | | throws SQLException |
| 530 | | | { |
| 531 | 0 | | return mPreparedStatement.executeUpdate(sql, columnNames); |
| 532 | | | } |
| 533 | | | |
| 534 | | | {@inheritDoc} |
| 535 | | | public Connection getConnection () |
| 536 | | | throws SQLException |
| 537 | | | { |
| 538 | 0 | | return mPreparedStatement.getConnection(); |
| 539 | | | } |
| 540 | | | |
| 541 | | | {@inheritDoc} |
| 542 | | | public int getFetchDirection () |
| 543 | | | throws SQLException |
| 544 | | | { |
| 545 | 0 | | return mPreparedStatement.getFetchDirection(); |
| 546 | | | } |
| 547 | | | |
| 548 | | | {@inheritDoc} |
| 549 | | | public int getFetchSize () |
| 550 | | | throws SQLException |
| 551 | | | { |
| 552 | 0 | | return mPreparedStatement.getFetchSize(); |
| 553 | | | } |
| 554 | | | |
| 555 | | | {@inheritDoc} |
| 556 | | | public ResultSet getGeneratedKeys () |
| 557 | | | throws SQLException |
| 558 | | | { |
| 559 | 0 | | return mPreparedStatement.getGeneratedKeys(); |
| 560 | | | } |
| 561 | | | |
| 562 | | | {@inheritDoc} |
| 563 | | | public int getMaxFieldSize () |
| 564 | | | throws SQLException |
| 565 | | | { |
| 566 | 0 | | return mPreparedStatement.getMaxFieldSize(); |
| 567 | | | } |
| 568 | | | |
| 569 | | | {@inheritDoc} |
| 570 | | | public int getMaxRows () |
| 571 | | | throws SQLException |
| 572 | | | { |
| 573 | 0 | | return mPreparedStatement.getMaxRows(); |
| 574 | | | } |
| 575 | | | |
| 576 | | | {@inheritDoc} |
| 577 | | | public ResultSetMetaData getMetaData () |
| 578 | | | throws SQLException |
| 579 | | | { |
| 580 | 0 | | return mPreparedStatement.getMetaData(); |
| 581 | | | } |
| 582 | | | |
| 583 | | | {@inheritDoc} |
| 584 | | | public boolean getMoreResults () |
| 585 | | | throws SQLException |
| 586 | | | { |
| 587 | 0 | | return mPreparedStatement.getMoreResults(); |
| 588 | | | } |
| 589 | | | |
| 590 | | | {@inheritDoc} |
| 591 | | | public boolean getMoreResults (int current) |
| 592 | | | throws SQLException |
| 593 | | | { |
| 594 | 0 | | return mPreparedStatement.getMoreResults(current); |
| 595 | | | } |
| 596 | | | |
| 597 | | | {@inheritDoc} |
| 598 | | | public ParameterMetaData getParameterMetaData () |
| 599 | | | throws SQLException |
| 600 | | | { |
| 601 | 0 | | return mPreparedStatement.getParameterMetaData(); |
| 602 | | | } |
| 603 | | | |
| 604 | | | {@inheritDoc} |
| 605 | | | public int getQueryTimeout () |
| 606 | | | throws SQLException |
| 607 | | | { |
| 608 | 0 | | return mPreparedStatement.getQueryTimeout(); |
| 609 | | | } |
| 610 | | | |
| 611 | | | {@inheritDoc} |
| 612 | | | public ResultSet getResultSet () |
| 613 | | | throws SQLException |
| 614 | | | { |
| 615 | 0 | | return mPreparedStatement.getResultSet(); |
| 616 | | | } |
| 617 | | | |
| 618 | | | {@inheritDoc} |
| 619 | | | public int getResultSetConcurrency () |
| 620 | | | throws SQLException |
| 621 | | | { |
| 622 | 0 | | return mPreparedStatement.getResultSetConcurrency(); |
| 623 | | | } |
| 624 | | | |
| 625 | | | {@inheritDoc} |
| 626 | | | public int getResultSetHoldability () |
| 627 | | | throws SQLException |
| 628 | | | { |
| 629 | 0 | | return mPreparedStatement.getResultSetHoldability(); |
| 630 | | | } |
| 631 | | | |
| 632 | | | {@inheritDoc} |
| 633 | | | public int getResultSetType () |
| 634 | | | throws SQLException |
| 635 | | | { |
| 636 | 0 | | return mPreparedStatement.getResultSetType(); |
| 637 | | | } |
| 638 | | | |
| 639 | | | {@inheritDoc} |
| 640 | | | public int getUpdateCount () |
| 641 | | | throws SQLException |
| 642 | | | { |
| 643 | 0 | | return mPreparedStatement.getUpdateCount(); |
| 644 | | | } |
| 645 | | | |
| 646 | | | {@inheritDoc} |
| 647 | | | public SQLWarning getWarnings () |
| 648 | | | throws SQLException |
| 649 | | | { |
| 650 | 0 | | return mPreparedStatement.getWarnings(); |
| 651 | | | } |
| 652 | | | |
| 653 | | | {@inheritDoc} |
| 654 | | | public void setArray (int i, Array x) |
| 655 | | | throws SQLException |
| 656 | | | { |
| 657 | 0 | | mPreparedStatement.setArray(i, x); |
| 658 | 0 | | } |
| 659 | | | |
| 660 | | | {@inheritDoc} |
| 661 | | | public void setAsciiStream (int parameterIndex, InputStream x, int length) |
| 662 | | | throws SQLException |
| 663 | | | { |
| 664 | 0 | | mPreparedStatement.setAsciiStream(parameterIndex, x, length); |
| 665 | 0 | | } |
| 666 | | | |
| 667 | | | {@inheritDoc} |
| 668 | | | public void setBigDecimal (int parameterIndex, BigDecimal x) |
| 669 | | | throws SQLException |
| 670 | | | { |
| 671 | 0 | | mPreparedStatement.setBigDecimal(parameterIndex, x); |
| 672 | 0 | | } |
| 673 | | | |
| 674 | | | {@inheritDoc} |
| 675 | | | public void setBinaryStream ( |
| 676 | | | int parameterIndex, InputStream x, int length) |
| 677 | | | throws SQLException |
| 678 | | | { |
| 679 | 0 | | mPreparedStatement.setBinaryStream(parameterIndex, x, length); |
| 680 | 0 | | } |
| 681 | | | |
| 682 | | | {@inheritDoc} |
| 683 | | | public void setBlob (int i, Blob x) |
| 684 | | | throws SQLException |
| 685 | | | { |
| 686 | 0 | | mPreparedStatement.setBlob(i, x); |
| 687 | 0 | | } |
| 688 | | | |
| 689 | | | {@inheritDoc} |
| 690 | | | public void setBoolean (int parameterIndex, boolean x) |
| 691 | | | throws SQLException |
| 692 | | | { |
| 693 | 0 | | mPreparedStatement.setBoolean(parameterIndex, x); |
| 694 | 0 | | } |
| 695 | | | |
| 696 | | | {@inheritDoc} |
| 697 | | | public void setByte (int parameterIndex, byte x) |
| 698 | | | throws SQLException |
| 699 | | | { |
| 700 | 0 | | mPreparedStatement.setByte(parameterIndex, x); |
| 701 | 0 | | } |
| 702 | | | |
| 703 | | | {@inheritDoc} |
| 704 | | | public void setBytes (int parameterIndex, byte[] x) |
| 705 | | | throws SQLException |
| 706 | | | { |
| 707 | 0 | | mPreparedStatement.setBytes(parameterIndex, x); |
| 708 | 0 | | } |
| 709 | | | |
| 710 | | | {@inheritDoc} |
| 711 | | | public void setCharacterStream (int parameterIndex, Reader reader, |
| 712 | | | int length) |
| 713 | | | throws SQLException |
| 714 | | | { |
| 715 | 0 | | mPreparedStatement.setCharacterStream(parameterIndex, reader, length); |
| 716 | 0 | | } |
| 717 | | | |
| 718 | | | {@inheritDoc} |
| 719 | | | public void setClob (int i, Clob x) |
| 720 | | | throws SQLException |
| 721 | | | { |
| 722 | 0 | | mPreparedStatement.setClob(i, x); |
| 723 | 0 | | } |
| 724 | | | |
| 725 | | | {@inheritDoc} |
| 726 | | | public void setCursorName (String name) |
| 727 | | | throws SQLException |
| 728 | | | { |
| 729 | 0 | | mPreparedStatement.setCursorName(name); |
| 730 | 0 | | } |
| 731 | | | |
| 732 | | | {@inheritDoc} |
| 733 | | | public void setDate (int parameterIndex, Date x) |
| 734 | | | throws SQLException |
| 735 | | | { |
| 736 | 0 | | mPreparedStatement.setDate(parameterIndex, x); |
| 737 | 0 | | } |
| 738 | | | |
| 739 | | | {@inheritDoc} |
| 740 | | | public void setDate (int parameterIndex, Date x, Calendar cal) |
| 741 | | | throws SQLException |
| 742 | | | { |
| 743 | 0 | | mPreparedStatement.setDate(parameterIndex, x, cal); |
| 744 | 0 | | } |
| 745 | | | |
| 746 | | | {@inheritDoc} |
| 747 | | | public void setDouble (int parameterIndex, double x) |
| 748 | | | throws SQLException |
| 749 | | | { |
| 750 | 0 | | mPreparedStatement.setDouble(parameterIndex, x); |
| 751 | 0 | | } |
| 752 | | | |
| 753 | | | {@inheritDoc} |
| 754 | | | public void setEscapeProcessing (boolean enable) |
| 755 | | | throws SQLException |
| 756 | | | { |
| 757 | 0 | | mPreparedStatement.setEscapeProcessing(enable); |
| 758 | 0 | | } |
| 759 | | | |
| 760 | | | {@inheritDoc} |
| 761 | | | public void setFetchDirection (int direction) |
| 762 | | | throws SQLException |
| 763 | | | { |
| 764 | 0 | | mPreparedStatement.setFetchDirection(direction); |
| 765 | 0 | | } |
| 766 | | | |
| 767 | | | {@inheritDoc} |
| 768 | | | public void setFetchSize (int rows) |
| 769 | | | throws SQLException |
| 770 | | | { |
| 771 | 0 | | mPreparedStatement.setFetchSize(rows); |
| 772 | 0 | | } |
| 773 | | | |
| 774 | | | {@inheritDoc} |
| 775 | | | public void setFloat (int parameterIndex, float x) |
| 776 | | | throws SQLException |
| 777 | | | { |
| 778 | 0 | | mPreparedStatement.setFloat(parameterIndex, x); |
| 779 | 0 | | } |
| 780 | | | |
| 781 | | | {@inheritDoc} |
| 782 | | | public void setInt (int parameterIndex, int x) |
| 783 | | | throws SQLException |
| 784 | | | { |
| 785 | 0 | | mPreparedStatement.setInt(parameterIndex, x); |
| 786 | 0 | | } |
| 787 | | | |
| 788 | | | {@inheritDoc} |
| 789 | | | public void setLong (int parameterIndex, long x) |
| 790 | | | throws SQLException |
| 791 | | | { |
| 792 | 0 | | mPreparedStatement.setLong(parameterIndex, x); |
| 793 | 0 | | } |
| 794 | | | |
| 795 | | | {@inheritDoc} |
| 796 | | | public void setMaxFieldSize (int max) |
| 797 | | | throws SQLException |
| 798 | | | { |
| 799 | 0 | | mPreparedStatement.setMaxFieldSize(max); |
| 800 | 0 | | } |
| 801 | | | |
| 802 | | | {@inheritDoc} |
| 803 | | | public void setMaxRows (int max) |
| 804 | | | throws SQLException |
| 805 | | | { |
| 806 | 0 | | mPreparedStatement.setMaxRows(max); |
| 807 | 0 | | } |
| 808 | | | |
| 809 | | | {@inheritDoc} |
| 810 | | | public void setNull (int parameterIndex, int sqlType) |
| 811 | | | throws SQLException |
| 812 | | | { |
| 813 | 0 | | mPreparedStatement.setNull(parameterIndex, sqlType); |
| 814 | 0 | | } |
| 815 | | | |
| 816 | | | {@inheritDoc} |
| 817 | | | public void setNull (int paramIndex, int sqlType, String typeName) |
| 818 | | | throws SQLException |
| 819 | | | { |
| 820 | 0 | | mPreparedStatement.setNull(paramIndex, sqlType, typeName); |
| 821 | 0 | | } |
| 822 | | | |
| 823 | | | {@inheritDoc} |
| 824 | | | public void setObject (int parameterIndex, Object x) |
| 825 | | | throws SQLException |
| 826 | | | { |
| 827 | 0 | | mPreparedStatement.setObject(parameterIndex, x); |
| 828 | 0 | | } |
| 829 | | | |
| 830 | | | {@inheritDoc} |
| 831 | | | public void setObject (int parameterIndex, Object x, int targetSqlType) |
| 832 | | | throws SQLException |
| 833 | | | { |
| 834 | 0 | | mPreparedStatement.setObject(parameterIndex, x, targetSqlType); |
| 835 | 0 | | } |
| 836 | | | |
| 837 | | | {@inheritDoc} |
| 838 | | | public void setObject (int parameterIndex, Object x, int targetSqlType, |
| 839 | | | int scale) |
| 840 | | | throws SQLException |
| 841 | | | { |
| 842 | 0 | | mPreparedStatement.setObject(parameterIndex, x, targetSqlType, scale); |
| 843 | 0 | | } |
| 844 | | | |
| 845 | | | {@inheritDoc} |
| 846 | | | public void setQueryTimeout (int seconds) |
| 847 | | | throws SQLException |
| 848 | | | { |
| 849 | 0 | | mPreparedStatement.setQueryTimeout(seconds); |
| 850 | 0 | | } |
| 851 | | | |
| 852 | | | {@inheritDoc} |
| 853 | | | public void setRef (int i, Ref x) |
| 854 | | | throws SQLException |
| 855 | | | { |
| 856 | 0 | | mPreparedStatement.setRef(i, x); |
| 857 | 0 | | } |
| 858 | | | |
| 859 | | | {@inheritDoc} |
| 860 | | | public void setShort (int parameterIndex, short x) |
| 861 | | | throws SQLException |
| 862 | | | { |
| 863 | 0 | | mPreparedStatement.setShort(parameterIndex, x); |
| 864 | 0 | | } |
| 865 | | | |
| 866 | | | {@inheritDoc} |
| 867 | | | public void setString (int parameterIndex, String x) |
| 868 | | | throws SQLException |
| 869 | | | { |
| 870 | 0 | | mPreparedStatement.setString(parameterIndex, x); |
| 871 | 0 | | } |
| 872 | | | |
| 873 | | | {@inheritDoc} |
| 874 | | | public void setTime (int parameterIndex, Time x) |
| 875 | | | throws SQLException |
| 876 | | | { |
| 877 | 0 | | mPreparedStatement.setTime(parameterIndex, x); |
| 878 | 0 | | } |
| 879 | | | |
| 880 | | | {@inheritDoc} |
| 881 | | | public void setTime (int parameterIndex, Time x, Calendar cal) |
| 882 | | | throws SQLException |
| 883 | | | { |
| 884 | 0 | | mPreparedStatement.setTime(parameterIndex, x, cal); |
| 885 | 0 | | } |
| 886 | | | |
| 887 | | | {@inheritDoc} |
| 888 | | | public void setTimestamp (int parameterIndex, Timestamp x) |
| 889 | | | throws SQLException |
| 890 | | | { |
| 891 | 0 | | mPreparedStatement.setTimestamp(parameterIndex, x); |
| 892 | 0 | | } |
| 893 | | | |
| 894 | | | {@inheritDoc} |
| 895 | | | public void setTimestamp (int parameterIndex, Timestamp x, Calendar cal) |
| 896 | | | throws SQLException |
| 897 | | | { |
| 898 | 0 | | mPreparedStatement.setTimestamp(parameterIndex, x, cal); |
| 899 | 0 | | } |
| 900 | | | |
| 901 | | | {@inheritDoc} |
| 902 | | | public void setUnicodeStream (int parameterIndex, InputStream x, |
| 903 | | | int length) |
| 904 | | | throws SQLException |
| 905 | | | { |
| 906 | 0 | (4) | mPreparedStatement.setUnicodeStream(parameterIndex, x, length); |
| 907 | 0 | | } |
| 908 | | | |
| 909 | | | {@inheritDoc} |
| 910 | | | public void setURL (int parameterIndex, URL x) |
| 911 | | | throws SQLException |
| 912 | | | { |
| 913 | 0 | | mPreparedStatement.setURL(parameterIndex, x); |
| 914 | 0 | | } |
| 915 | | | } |
| 916 | | | } |