1 16 17 package org.springframework.jdbc.support.rowset; 18 19 import java.math.BigDecimal ; 20 import java.sql.Date ; 21 import java.sql.ResultSet ; 22 import java.sql.SQLException ; 23 import java.sql.Time ; 24 import java.sql.Timestamp ; 25 import java.util.Calendar ; 26 import java.util.Map ; 27 28 import org.springframework.jdbc.InvalidResultSetAccessException; 29 30 54 public class ResultSetWrappingSqlRowSet implements SqlRowSet { 55 56 private final ResultSet resultSet; 57 58 private final SqlRowSetMetaData rowSetMetaData; 59 60 61 71 public ResultSetWrappingSqlRowSet(ResultSet resultSet) throws InvalidResultSetAccessException { 72 this.resultSet = resultSet; 73 try { 74 this.rowSetMetaData = new ResultSetWrappingSqlRowSetMetaData(resultSet.getMetaData()); 75 } 76 catch (SQLException se) { 77 throw new InvalidResultSetAccessException(se); 78 } 79 } 80 81 86 public ResultSet getResultSet() { 87 return this.resultSet; 88 } 89 90 93 public SqlRowSetMetaData getMetaData() { 94 return this.rowSetMetaData; 95 } 96 97 100 public int findColumn(String columnName) throws InvalidResultSetAccessException { 101 try { 102 return this.resultSet.findColumn(columnName); 103 } 104 catch (SQLException se) { 105 throw new InvalidResultSetAccessException(se); 106 } 107 } 108 109 110 112 115 public BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException { 116 try { 117 return this.resultSet.getBigDecimal(columnIndex); 118 } 119 catch (SQLException se) { 120 throw new InvalidResultSetAccessException(se); 121 } 122 } 123 124 127 public BigDecimal getBigDecimal(String columnName) throws InvalidResultSetAccessException { 128 try { 129 return this.resultSet.getBigDecimal(columnName); 130 } 131 catch (SQLException se) { 132 throw new InvalidResultSetAccessException(se); 133 } 134 } 135 136 139 public boolean getBoolean(int columnIndex) throws InvalidResultSetAccessException { 140 try { 141 return this.resultSet.getBoolean(columnIndex); 142 } 143 catch (SQLException se) { 144 throw new InvalidResultSetAccessException(se); 145 } 146 } 147 148 151 public boolean getBoolean(String columnName) throws InvalidResultSetAccessException { 152 try { 153 return this.resultSet.getBoolean(columnName); 154 } 155 catch (SQLException se) { 156 throw new InvalidResultSetAccessException(se); 157 } 158 } 159 160 163 public byte getByte(int columnIndex) throws InvalidResultSetAccessException { 164 try { 165 return this.resultSet.getByte(columnIndex); 166 } 167 catch (SQLException se) { 168 throw new InvalidResultSetAccessException(se); 169 } 170 } 171 172 175 public byte getByte(String columnName) throws InvalidResultSetAccessException { 176 try { 177 return this.resultSet.getByte(columnName); 178 } 179 catch (SQLException se) { 180 throw new InvalidResultSetAccessException(se); 181 } 182 } 183 184 187 public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException { 188 try { 189 return this.resultSet.getDate(columnIndex, cal); 190 } 191 catch (SQLException se) { 192 throw new InvalidResultSetAccessException(se); 193 } 194 } 195 196 199 public Date getDate(int columnIndex) throws InvalidResultSetAccessException { 200 try { 201 return this.resultSet.getDate(columnIndex); 202 } 203 catch (SQLException se) { 204 throw new InvalidResultSetAccessException(se); 205 } 206 } 207 210 public Date getDate(String columnName, Calendar cal) throws InvalidResultSetAccessException { 211 try { 212 return this.resultSet.getDate(columnName, cal); 213 } 214 catch (SQLException se) { 215 throw new InvalidResultSetAccessException(se); 216 } 217 } 218 219 222 public Date getDate(String columnName) throws InvalidResultSetAccessException { 223 try { 224 return this.resultSet.getDate(columnName); 225 } 226 catch (SQLException se) { 227 throw new InvalidResultSetAccessException(se); 228 } 229 } 230 231 234 public double getDouble(int columnIndex) throws InvalidResultSetAccessException { 235 try { 236 return this.resultSet.getDouble(columnIndex); 237 } 238 catch (SQLException se) { 239 throw new InvalidResultSetAccessException(se); 240 } 241 } 242 243 246 public double getDouble(String columnName) throws InvalidResultSetAccessException { 247 try { 248 return this.resultSet.getDouble(columnName); 249 } 250 catch (SQLException se) { 251 throw new InvalidResultSetAccessException(se); 252 } 253 } 254 255 258 public float getFloat(int columnIndex) throws InvalidResultSetAccessException { 259 try { 260 return this.resultSet.getFloat(columnIndex); 261 } 262 catch (SQLException se) { 263 throw new InvalidResultSetAccessException(se); 264 } 265 } 266 267 270 public float getFloat(String columnName) throws InvalidResultSetAccessException { 271 try { 272 return this.resultSet.getFloat(columnName); 273 } 274 catch (SQLException se) { 275 throw new InvalidResultSetAccessException(se); 276 } 277 } 278 281 public int getInt(int columnIndex) throws InvalidResultSetAccessException { 282 try { 283 return this.resultSet.getInt(columnIndex); 284 } 285 catch (SQLException se) { 286 throw new InvalidResultSetAccessException(se); 287 } 288 } 289 290 293 public int getInt(String columnName) throws InvalidResultSetAccessException { 294 try { 295 return this.resultSet.getInt(columnName); 296 } 297 catch (SQLException se) { 298 throw new InvalidResultSetAccessException(se); 299 } 300 } 301 302 305 public long getLong(int columnIndex) throws InvalidResultSetAccessException { 306 try { 307 return this.resultSet.getLong(columnIndex); 308 } 309 catch (SQLException se) { 310 throw new InvalidResultSetAccessException(se); 311 } 312 } 313 314 317 public long getLong(String columnName) throws InvalidResultSetAccessException { 318 try { 319 return this.resultSet.getLong(columnName); 320 } 321 catch (SQLException se) { 322 throw new InvalidResultSetAccessException(se); 323 } 324 } 325 326 329 public Object getObject(int i, Map map) throws InvalidResultSetAccessException { 330 try { 331 return this.resultSet.getObject(i, map); 332 } 333 catch (SQLException se) { 334 throw new InvalidResultSetAccessException(se); 335 } 336 } 337 338 341 public Object getObject(int columnIndex) throws InvalidResultSetAccessException { 342 try { 343 return this.resultSet.getObject(columnIndex); 344 } 345 catch (SQLException se) { 346 throw new InvalidResultSetAccessException(se); 347 } 348 } 349 350 353 public Object getObject(String columnName, Map map) throws InvalidResultSetAccessException { 354 try { 355 return this.resultSet.getObject(columnName, map); 356 } 357 catch (SQLException se) { 358 throw new InvalidResultSetAccessException(se); 359 } 360 } 361 362 365 public Object getObject(String columnName) throws InvalidResultSetAccessException { 366 try { 367 return this.resultSet.getObject(columnName); 368 } 369 catch (SQLException se) { 370 throw new InvalidResultSetAccessException(se); 371 } 372 } 373 374 377 public short getShort(int columnIndex) throws InvalidResultSetAccessException { 378 try { 379 return this.resultSet.getShort(columnIndex); 380 } 381 catch (SQLException se) { 382 throw new InvalidResultSetAccessException(se); 383 } 384 } 385 386 389 public short getShort(String columnName) throws InvalidResultSetAccessException { 390 try { 391 return this.resultSet.getShort(columnName); 392 } 393 catch (SQLException se) { 394 throw new InvalidResultSetAccessException(se); 395 } 396 } 397 398 401 public String getString(int columnIndex) throws InvalidResultSetAccessException { 402 try { 403 return this.resultSet.getString(columnIndex); 404 } 405 catch (SQLException se) { 406 throw new InvalidResultSetAccessException(se); 407 } 408 } 409 410 413 public String getString(String columnName) throws InvalidResultSetAccessException { 414 try { 415 return this.resultSet.getString(columnName); 416 } 417 catch (SQLException se) { 418 throw new InvalidResultSetAccessException(se); 419 } 420 } 421 422 425 public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException { 426 try { 427 return this.resultSet.getTime(columnIndex, cal); 428 } 429 catch (SQLException se) { 430 throw new InvalidResultSetAccessException(se); 431 } 432 } 433 434 437 public Time getTime(int columnIndex) throws InvalidResultSetAccessException { 438 try { 439 return this.resultSet.getTime(columnIndex); 440 } 441 catch (SQLException se) { 442 throw new InvalidResultSetAccessException(se); 443 } 444 } 445 446 449 public Time getTime(String columnName, Calendar cal) throws InvalidResultSetAccessException { 450 try { 451 return this.resultSet.getTime(columnName, cal); 452 } 453 catch (SQLException se) { 454 throw new InvalidResultSetAccessException(se); 455 } 456 } 457 458 461 public Time getTime(String columnName) throws InvalidResultSetAccessException { 462 try { 463 return this.resultSet.getTime(columnName); 464 } 465 catch (SQLException se) { 466 throw new InvalidResultSetAccessException(se); 467 } 468 } 469 470 473 public Timestamp getTimestamp(int columnIndex, Calendar cal) 474 throws InvalidResultSetAccessException { 475 try { 476 return this.resultSet.getTimestamp(columnIndex, cal); 477 } 478 catch (SQLException se) { 479 throw new InvalidResultSetAccessException(se); 480 } 481 } 482 483 486 public Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException { 487 try { 488 return this.resultSet.getTimestamp(columnIndex); 489 } 490 catch (SQLException se) { 491 throw new InvalidResultSetAccessException(se); 492 } 493 } 494 495 498 public Timestamp getTimestamp(String columnName, Calendar cal) 499 throws InvalidResultSetAccessException { 500 try { 501 return this.resultSet.getTimestamp(columnName, cal); 502 } 503 catch (SQLException se) { 504 throw new InvalidResultSetAccessException(se); 505 } 506 } 507 508 511 public Timestamp getTimestamp(String columnName) throws InvalidResultSetAccessException { 512 try { 513 return this.resultSet.getTimestamp(columnName); 514 } 515 catch (SQLException se) { 516 throw new InvalidResultSetAccessException(se); 517 } 518 } 519 520 521 523 526 public boolean absolute(int row) throws InvalidResultSetAccessException { 527 try { 528 return this.resultSet.absolute(row); 529 } 530 catch (SQLException se) { 531 throw new InvalidResultSetAccessException(se); 532 } 533 } 534 535 538 public void afterLast() throws InvalidResultSetAccessException { 539 try { 540 this.resultSet.afterLast(); 541 } 542 catch (SQLException se) { 543 throw new InvalidResultSetAccessException(se); 544 } 545 } 546 547 550 public void beforeFirst() throws InvalidResultSetAccessException { 551 try { 552 this.resultSet.beforeFirst(); 553 } 554 catch (SQLException se) { 555 throw new InvalidResultSetAccessException(se); 556 } 557 } 558 559 562 public boolean first() throws InvalidResultSetAccessException { 563 try { 564 return this.resultSet.first(); 565 } 566 catch (SQLException se) { 567 throw new InvalidResultSetAccessException(se); 568 } 569 } 570 571 574 public int getRow() throws InvalidResultSetAccessException { 575 try { 576 return this.resultSet.getRow(); 577 } 578 catch (SQLException se) { 579 throw new InvalidResultSetAccessException(se); 580 } 581 } 582 583 586 public boolean isAfterLast() throws InvalidResultSetAccessException { 587 try { 588 return this.resultSet.isAfterLast(); 589 } 590 catch (SQLException se) { 591 throw new InvalidResultSetAccessException(se); 592 } 593 } 594 595 598 public boolean isBeforeFirst() throws InvalidResultSetAccessException { 599 try { 600 return this.resultSet.isBeforeFirst(); 601 } 602 catch (SQLException se) { 603 throw new InvalidResultSetAccessException(se); 604 } 605 } 606 607 610 public boolean isFirst() throws InvalidResultSetAccessException { 611 try { 612 return this.resultSet.isFirst(); 613 } 614 catch (SQLException se) { 615 throw new InvalidResultSetAccessException(se); 616 } 617 } 618 619 622 public boolean isLast() throws InvalidResultSetAccessException { 623 try { 624 return this.resultSet.isLast(); 625 } 626 catch (SQLException se) { 627 throw new InvalidResultSetAccessException(se); 628 } 629 } 630 631 634 public boolean last() throws InvalidResultSetAccessException { 635 try { 636 return this.resultSet.last(); 637 } 638 catch (SQLException se) { 639 throw new InvalidResultSetAccessException(se); 640 } 641 } 642 643 646 public boolean next() throws InvalidResultSetAccessException { 647 try { 648 return this.resultSet.next(); 649 } 650 catch (SQLException se) { 651 throw new InvalidResultSetAccessException(se); 652 } 653 } 654 655 658 public boolean previous() throws InvalidResultSetAccessException { 659 try { 660 return this.resultSet.previous(); 661 } 662 catch (SQLException se) { 663 throw new InvalidResultSetAccessException(se); 664 } 665 } 666 667 670 public boolean relative(int rows) throws InvalidResultSetAccessException { 671 try { 672 return this.resultSet.relative(rows); 673 } 674 catch (SQLException se) { 675 throw new InvalidResultSetAccessException(se); 676 } 677 } 678 679 682 public boolean wasNull() throws InvalidResultSetAccessException { 683 try { 684 return this.resultSet.wasNull(); 685 } 686 catch (SQLException se) { 687 throw new InvalidResultSetAccessException(se); 688 } 689 } 690 691 } 692 | Popular Tags |