1 16 17 18 package org.apache.commons.beanutils; 19 20 21 import java.io.InputStream ; 22 import java.io.Reader ; 23 import java.math.BigDecimal ; 24 import java.net.URL ; 25 import java.sql.Array ; 26 import java.sql.Blob ; 27 import java.sql.Clob ; 28 import java.sql.Date ; 29 import java.sql.Ref ; 30 import java.sql.ResultSet ; 31 import java.sql.ResultSetMetaData ; 32 import java.sql.SQLException ; 33 import java.sql.SQLWarning ; 34 import java.sql.Statement ; 35 import java.sql.Time ; 36 import java.sql.Timestamp ; 37 import java.util.Calendar ; 38 import java.util.Map ; 39 40 41 48 49 public class TestResultSet implements ResultSet { 50 51 52 54 55 58 protected int row = 0; 59 60 61 64 protected long timestamp = System.currentTimeMillis(); 65 66 67 69 70 public void close() throws SQLException { 71 ; } 73 74 75 public ResultSetMetaData getMetaData() throws SQLException { 76 return (new TestResultSetMetaData()); 77 } 78 79 80 public Object getObject(String columnName) throws SQLException { 81 if (row > 5) { 82 throw new SQLException ("No current row"); 83 } 84 if ("bigdecimalproperty".equals(columnName)) { 85 return (new BigDecimal (123.45)); 86 } else if ("booleanproperty".equals(columnName)) { 87 if ((row % 2) == 0) { 88 return (Boolean.TRUE); 89 } else { 90 return (Boolean.FALSE); 91 } 92 } else if ("byteproperty".equals(columnName)) { 93 return (new Byte ((byte) row)); 94 } else if ("dateproperty".equals(columnName)) { 95 return (new Date (timestamp)); 96 } else if ("doubleproperty".equals(columnName)) { 97 return (new Double (321.0)); 98 } else if ("floatproperty".equals(columnName)) { 99 return (new Float ((float) 123.0)); 100 } else if ("intproperty".equals(columnName)) { 101 return (new Integer (100 + row)); 102 } else if ("longproperty".equals(columnName)) { 103 return (new Long (200 + row)); 104 } else if ("nullproperty".equals(columnName)) { 105 return (null); 106 } else if ("shortproperty".equals(columnName)) { 107 return (new Short ((short) (300 + row))); 108 } else if ("stringproperty".equals(columnName)) { 109 return ("This is a string"); 110 } else if ("timeproperty".equals(columnName)) { 111 return (new Time (timestamp)); 112 } else if ("timestampproperty".equals(columnName)) { 113 return (new Timestamp (timestamp)); 114 } else { 115 throw new SQLException ("Unknown column name " + columnName); 116 } 117 } 118 119 120 public boolean next() throws SQLException { 121 if (row++ < 5) { 122 return (true); 123 } else { 124 return (false); 125 } 126 } 127 128 129 public void updateObject(String columnName, Object x) 130 throws SQLException { 131 if (row > 5) { 132 throw new SQLException ("No current row"); 133 } 134 ; } 136 137 138 140 141 public boolean absolute(int row) throws SQLException { 142 throw new UnsupportedOperationException (); 143 } 144 145 146 public void afterLast() throws SQLException { 147 throw new UnsupportedOperationException (); 148 } 149 150 151 public void beforeFirst() throws SQLException { 152 throw new UnsupportedOperationException (); 153 } 154 155 156 public void cancelRowUpdates() throws SQLException { 157 throw new UnsupportedOperationException (); 158 } 159 160 161 public void clearWarnings() throws SQLException { 162 throw new UnsupportedOperationException (); 163 } 164 165 166 public void deleteRow() throws SQLException { 167 throw new UnsupportedOperationException (); 168 } 169 170 171 public int findColumn(String columnName) throws SQLException { 172 throw new UnsupportedOperationException (); 173 } 174 175 176 public boolean first() throws SQLException { 177 throw new UnsupportedOperationException (); 178 } 179 180 181 public Array getArray(int columnIndex) throws SQLException { 182 throw new UnsupportedOperationException (); 183 } 184 185 186 public Array getArray(String columnName) throws SQLException { 187 throw new UnsupportedOperationException (); 188 } 189 190 191 public InputStream getAsciiStream(int columnIndex) throws SQLException { 192 throw new UnsupportedOperationException (); 193 } 194 195 196 public InputStream getAsciiStream(String columnName) throws SQLException { 197 throw new UnsupportedOperationException (); 198 } 199 200 201 public BigDecimal getBigDecimal(int columnIndex) throws SQLException { 202 throw new UnsupportedOperationException (); 203 } 204 205 206 public BigDecimal getBigDecimal(int columnIndex, int scale) 207 throws SQLException { 208 throw new UnsupportedOperationException (); 209 } 210 211 212 public BigDecimal getBigDecimal(String columnName) throws SQLException { 213 throw new UnsupportedOperationException (); 214 } 215 216 217 218 public BigDecimal getBigDecimal(String columnName, int scale) 219 throws SQLException { 220 throw new UnsupportedOperationException (); 221 } 222 223 224 public InputStream getBinaryStream(int columnIndex) throws SQLException { 225 throw new UnsupportedOperationException (); 226 } 227 228 229 public InputStream getBinaryStream(String columnName) throws SQLException { 230 throw new UnsupportedOperationException (); 231 } 232 233 234 public Blob getBlob(int columnIndex) throws SQLException { 235 throw new UnsupportedOperationException (); 236 } 237 238 239 public Blob getBlob(String columnName) throws SQLException { 240 throw new UnsupportedOperationException (); 241 } 242 243 244 public boolean getBoolean(int columnIndex) throws SQLException { 245 throw new UnsupportedOperationException (); 246 } 247 248 249 public boolean getBoolean(String columnName) throws SQLException { 250 throw new UnsupportedOperationException (); 251 } 252 253 254 public byte getByte(int columnIndex) throws SQLException { 255 throw new UnsupportedOperationException (); 256 } 257 258 259 public byte getByte(String columnName) throws SQLException { 260 throw new UnsupportedOperationException (); 261 } 262 263 264 public byte[] getBytes(int columnIndex) throws SQLException { 265 throw new UnsupportedOperationException (); 266 } 267 268 269 public byte[] getBytes(String columnName) throws SQLException { 270 throw new UnsupportedOperationException (); 271 } 272 273 274 public Reader getCharacterStream(int columnIndex) 275 throws SQLException { 276 throw new UnsupportedOperationException (); 277 } 278 279 280 public Reader getCharacterStream(String columnName) throws SQLException { 281 throw new UnsupportedOperationException (); 282 } 283 284 285 public Clob getClob(int columnIndex) throws SQLException { 286 throw new UnsupportedOperationException (); 287 } 288 289 290 public Clob getClob(String columnName) throws SQLException { 291 throw new UnsupportedOperationException (); 292 } 293 294 295 public int getConcurrency() throws SQLException { 296 throw new UnsupportedOperationException (); 297 } 298 299 300 public String getCursorName() throws SQLException { 301 throw new UnsupportedOperationException (); 302 } 303 304 305 public Date getDate(int columnIndex) throws SQLException { 306 throw new UnsupportedOperationException (); 307 } 308 309 310 public Date getDate(int columnIndex, Calendar cal) throws SQLException { 311 throw new UnsupportedOperationException (); 312 } 313 314 315 public Date getDate(String columnName) throws SQLException { 316 throw new UnsupportedOperationException (); 317 } 318 319 320 public Date getDate(String columnName, Calendar cal) throws SQLException { 321 throw new UnsupportedOperationException (); 322 } 323 324 325 public double getDouble(int columnIndex) throws SQLException { 326 throw new UnsupportedOperationException (); 327 } 328 329 330 public double getDouble(String columnName) throws SQLException { 331 throw new UnsupportedOperationException (); 332 } 333 334 335 public int getFetchDirection() throws SQLException { 336 throw new UnsupportedOperationException (); 337 } 338 339 340 public int getFetchSize() throws SQLException { 341 throw new UnsupportedOperationException (); 342 } 343 344 345 public float getFloat(int columnIndex) throws SQLException { 346 throw new UnsupportedOperationException (); 347 } 348 349 350 public float getFloat(String columnName) throws SQLException { 351 throw new UnsupportedOperationException (); 352 } 353 354 355 public int getInt(int columnIndex) throws SQLException { 356 throw new UnsupportedOperationException (); 357 } 358 359 360 public int getInt(String columnName) throws SQLException { 361 throw new UnsupportedOperationException (); 362 } 363 364 365 public long getLong(int columnIndex) throws SQLException { 366 throw new UnsupportedOperationException (); 367 } 368 369 370 public long getLong(String columnName) throws SQLException { 371 throw new UnsupportedOperationException (); 372 } 373 374 375 public Object getObject(int columnIndex) throws SQLException { 376 throw new UnsupportedOperationException (); 377 } 378 379 380 public Object getObject(int columnIndex, Map map) throws SQLException { 381 throw new UnsupportedOperationException (); 382 } 383 384 385 public Object getObject(String columnName, Map map) throws SQLException { 386 throw new UnsupportedOperationException (); 387 } 388 389 390 public Ref getRef(int columnIndex) throws SQLException { 391 throw new UnsupportedOperationException (); 392 } 393 394 395 public Ref getRef(String columnName) throws SQLException { 396 throw new UnsupportedOperationException (); 397 } 398 399 400 public int getRow() throws SQLException { 401 throw new UnsupportedOperationException (); 402 } 403 404 405 public short getShort(int columnIndex) throws SQLException { 406 throw new UnsupportedOperationException (); 407 } 408 409 410 public short getShort(String columnName) throws SQLException { 411 throw new UnsupportedOperationException (); 412 } 413 414 415 public Statement getStatement() throws SQLException { 416 throw new UnsupportedOperationException (); 417 } 418 419 420 public String getString(int columnIndex) throws SQLException { 421 throw new UnsupportedOperationException (); 422 } 423 424 425 public String getString(String columnName) throws SQLException { 426 throw new UnsupportedOperationException (); 427 } 428 429 430 public Time getTime(int columnIndex) throws SQLException { 431 throw new UnsupportedOperationException (); 432 } 433 434 435 public Time getTime(int columnIndex, Calendar cal) throws SQLException { 436 throw new UnsupportedOperationException (); 437 } 438 439 440 public Time getTime(String columnName) throws SQLException { 441 throw new UnsupportedOperationException (); 442 } 443 444 445 public Time getTime(String columnName, Calendar cal) throws SQLException { 446 throw new UnsupportedOperationException (); 447 } 448 449 450 public Timestamp getTimestamp(int columnIndex) throws SQLException { 451 throw new UnsupportedOperationException (); 452 } 453 454 455 public Timestamp getTimestamp(int columnIndex, Calendar cal) 456 throws SQLException { 457 throw new UnsupportedOperationException (); 458 } 459 460 461 public Timestamp getTimestamp(String columnName) throws SQLException { 462 throw new UnsupportedOperationException (); 463 } 464 465 466 public Timestamp getTimestamp(String columnName, Calendar cal) 467 throws SQLException { 468 throw new UnsupportedOperationException (); 469 } 470 471 472 public int getType() throws SQLException { 473 throw new UnsupportedOperationException (); 474 } 475 476 477 478 public InputStream getUnicodeStream(int columnIndex) throws SQLException { 479 throw new UnsupportedOperationException (); 480 } 481 482 483 484 public InputStream getUnicodeStream(String columnName) throws SQLException { 485 throw new UnsupportedOperationException (); 486 } 487 488 489 public URL getURL(int columnIndex) throws SQLException { 490 throw new UnsupportedOperationException (); 491 } 492 493 494 public URL getURL(String columnName) throws SQLException { 495 throw new UnsupportedOperationException (); 496 } 497 498 499 public SQLWarning getWarnings() throws SQLException { 500 throw new UnsupportedOperationException (); 501 } 502 503 504 public void insertRow() throws SQLException { 505 throw new UnsupportedOperationException (); 506 } 507 508 509 public boolean isAfterLast() throws SQLException { 510 throw new UnsupportedOperationException (); 511 } 512 513 514 public boolean isBeforeFirst() throws SQLException { 515 throw new UnsupportedOperationException (); 516 } 517 518 519 public boolean isFirst() throws SQLException { 520 throw new UnsupportedOperationException (); 521 } 522 523 524 public boolean isLast() throws SQLException { 525 throw new UnsupportedOperationException (); 526 } 527 528 529 public boolean last() throws SQLException { 530 throw new UnsupportedOperationException (); 531 } 532 533 534 public void moveToCurrentRow() throws SQLException { 535 throw new UnsupportedOperationException (); 536 } 537 538 539 public void moveToInsertRow() throws SQLException { 540 throw new UnsupportedOperationException (); 541 } 542 543 544 public boolean previous() throws SQLException { 545 throw new UnsupportedOperationException (); 546 } 547 548 549 public void refreshRow() throws SQLException { 550 throw new UnsupportedOperationException (); 551 } 552 553 554 public boolean relative(int rows) throws SQLException { 555 throw new UnsupportedOperationException (); 556 } 557 558 559 public boolean rowDeleted() throws SQLException { 560 throw new UnsupportedOperationException (); 561 } 562 563 564 public boolean rowInserted() throws SQLException { 565 throw new UnsupportedOperationException (); 566 } 567 568 569 public boolean rowUpdated() throws SQLException { 570 throw new UnsupportedOperationException (); 571 } 572 573 574 public void setFetchDirection(int direction) throws SQLException { 575 throw new UnsupportedOperationException (); 576 } 577 578 579 public void setFetchSize(int size) throws SQLException { 580 throw new UnsupportedOperationException (); 581 } 582 583 584 public void updateArray(int columnPosition, Array x) 585 throws SQLException { 586 throw new UnsupportedOperationException (); 587 } 588 589 590 public void updateArray(String columnName, Array x) 591 throws SQLException { 592 throw new UnsupportedOperationException (); 593 } 594 595 596 public void updateAsciiStream(int columnPosition, InputStream x, int len) 597 throws SQLException { 598 throw new UnsupportedOperationException (); 599 } 600 601 602 public void updateAsciiStream(String columnName, InputStream x, int len) 603 throws SQLException { 604 throw new UnsupportedOperationException (); 605 } 606 607 608 public void updateBigDecimal(int columnPosition, BigDecimal x) 609 throws SQLException { 610 throw new UnsupportedOperationException (); 611 } 612 613 614 public void updateBigDecimal(String columnName, BigDecimal x) 615 throws SQLException { 616 throw new UnsupportedOperationException (); 617 } 618 619 620 public void updateBinaryStream(int columnPosition, InputStream x, int len) 621 throws SQLException { 622 throw new UnsupportedOperationException (); 623 } 624 625 626 public void updateBinaryStream(String columnName, InputStream x, int len) 627 throws SQLException { 628 throw new UnsupportedOperationException (); 629 } 630 631 632 public void updateBlob(int columnPosition, Blob x) 633 throws SQLException { 634 throw new UnsupportedOperationException (); 635 } 636 637 638 public void updateBlob(String columnName, Blob x) 639 throws SQLException { 640 throw new UnsupportedOperationException (); 641 } 642 643 644 public void updateBoolean(int columnPosition, boolean x) 645 throws SQLException { 646 throw new UnsupportedOperationException (); 647 } 648 649 650 public void updateBoolean(String columnName, boolean x) 651 throws SQLException { 652 throw new UnsupportedOperationException (); 653 } 654 655 656 public void updateByte(int columnPosition, byte x) 657 throws SQLException { 658 throw new UnsupportedOperationException (); 659 } 660 661 662 public void updateByte(String columnName, byte x) 663 throws SQLException { 664 throw new UnsupportedOperationException (); 665 } 666 667 668 public void updateBytes(int columnPosition, byte x[]) 669 throws SQLException { 670 throw new UnsupportedOperationException (); 671 } 672 673 674 public void updateBytes(String columnName, byte x[]) 675 throws SQLException { 676 throw new UnsupportedOperationException (); 677 } 678 679 680 public void updateCharacterStream(int columnPosition, Reader x, int len) 681 throws SQLException { 682 throw new UnsupportedOperationException (); 683 } 684 685 686 public void updateCharacterStream(String columnName, Reader x, int len) 687 throws SQLException { 688 throw new UnsupportedOperationException (); 689 } 690 691 692 public void updateClob(int columnPosition, Clob x) 693 throws SQLException { 694 throw new UnsupportedOperationException (); 695 } 696 697 698 public void updateClob(String columnName, Clob x) 699 throws SQLException { 700 throw new UnsupportedOperationException (); 701 } 702 703 704 public void updateDate(int columnPosition, Date x) 705 throws SQLException { 706 throw new UnsupportedOperationException (); 707 } 708 709 710 public void updateDate(String columnName, Date x) 711 throws SQLException { 712 throw new UnsupportedOperationException (); 713 } 714 715 716 public void updateDouble(int columnPosition, double x) 717 throws SQLException { 718 throw new UnsupportedOperationException (); 719 } 720 721 722 public void updateDouble(String columnName, double x) 723 throws SQLException { 724 throw new UnsupportedOperationException (); 725 } 726 727 728 public void updateFloat(int columnPosition, float x) 729 throws SQLException { 730 throw new UnsupportedOperationException (); 731 } 732 733 734 public void updateFloat(String columnName, float x) 735 throws SQLException { 736 throw new UnsupportedOperationException (); 737 } 738 739 740 public void updateInt(int columnPosition, int x) 741 throws SQLException { 742 throw new UnsupportedOperationException (); 743 } 744 745 746 public void updateInt(String columnName, int x) 747 throws SQLException { 748 throw new UnsupportedOperationException (); 749 } 750 751 752 public void updateLong(int columnPosition, long x) 753 throws SQLException { 754 throw new UnsupportedOperationException (); 755 } 756 757 758 public void updateLong(String columnName, long x) 759 throws SQLException { 760 throw new UnsupportedOperationException (); 761 } 762 763 764 public void updateNull(int columnPosition) 765 throws SQLException { 766 throw new UnsupportedOperationException (); 767 } 768 769 770 public void updateNull(String columnName) 771 throws SQLException { 772 throw new UnsupportedOperationException (); 773 } 774 775 776 public void updateObject(int columnPosition, Object x) 777 throws SQLException { 778 throw new UnsupportedOperationException (); 779 } 780 781 782 public void updateObject(int columnPosition, Object x, int scale) 783 throws SQLException { 784 throw new UnsupportedOperationException (); 785 } 786 787 788 public void updateObject(String columnName, Object x, int scale) 789 throws SQLException { 790 throw new UnsupportedOperationException (); 791 } 792 793 794 public void updateRef(int columnPosition, Ref x) 795 throws SQLException { 796 throw new UnsupportedOperationException (); 797 } 798 799 800 public void updateRef(String columnName, Ref x) 801 throws SQLException { 802 throw new UnsupportedOperationException (); 803 } 804 805 806 public void updateRow() throws SQLException { 807 throw new UnsupportedOperationException (); 808 } 809 810 811 public void updateShort(int columnPosition, short x) 812 throws SQLException { 813 throw new UnsupportedOperationException (); 814 } 815 816 817 public void updateShort(String columnName, short x) 818 throws SQLException { 819 throw new UnsupportedOperationException (); 820 } 821 822 823 public void updateString(int columnPosition, String x) 824 throws SQLException { 825 throw new UnsupportedOperationException (); 826 } 827 828 829 public void updateString(String columnName, String x) 830 throws SQLException { 831 throw new UnsupportedOperationException (); 832 } 833 834 835 public void updateTime(int columnPosition, Time x) 836 throws SQLException { 837 throw new UnsupportedOperationException (); 838 } 839 840 841 public void updateTime(String columnName, Time x) 842 throws SQLException { 843 throw new UnsupportedOperationException (); 844 } 845 846 847 public void updateTimestamp(int columnPosition, Timestamp x) 848 throws SQLException { 849 throw new UnsupportedOperationException (); 850 } 851 852 853 public void updateTimestamp(String columnName, Timestamp x) 854 throws SQLException { 855 throw new UnsupportedOperationException (); 856 } 857 858 859 public boolean wasNull() throws SQLException { 860 throw new UnsupportedOperationException (); 861 } 862 863 864 } 865 | Popular Tags |