1 22 package org.jboss.resource.adapter.jdbc; 23 24 import java.io.InputStream ; 25 import java.io.Reader ; 26 import java.math.BigDecimal ; 27 import java.net.URL ; 28 import java.sql.Array ; 29 import java.sql.Blob ; 30 import java.sql.Clob ; 31 import java.sql.Date ; 32 import java.sql.Ref ; 33 import java.sql.ResultSet ; 34 import java.sql.ResultSetMetaData ; 35 import java.sql.SQLException ; 36 import java.sql.SQLWarning ; 37 import java.sql.Statement ; 38 import java.sql.Time ; 39 import java.sql.Timestamp ; 40 import java.util.Calendar ; 41 import java.util.Map ; 42 43 49 public class WrappedResultSet implements ResultSet 50 { 51 52 private WrappedStatement statement; 53 54 55 private ResultSet resultSet; 56 57 58 private boolean closed = false; 59 60 61 private Object lock = new Object (); 62 63 69 public WrappedResultSet(WrappedStatement statement, ResultSet resultSet) 70 { 71 if (statement == null) 72 throw new IllegalArgumentException ("Null statement!"); 73 if (resultSet == null) 74 throw new IllegalArgumentException ("Null result set!"); 75 this.statement = statement; 76 this.resultSet = resultSet; 77 } 78 79 public boolean equals(Object o) 80 { 81 if (o == null) 82 return false; 83 else if (o == this) 84 return true; 85 else if (o instanceof WrappedResultSet) 86 return (resultSet.equals(((WrappedResultSet) o).resultSet)); 87 else if (o instanceof ResultSet ) 88 return resultSet.equals(o); 89 return false; 90 } 91 92 public int hashCode() 93 { 94 return resultSet.hashCode(); 95 } 96 97 public String toString() 98 { 99 return resultSet.toString(); 100 } 101 102 public ResultSet getUnderlyingResultSet() throws SQLException 103 { 104 checkState(); 105 return resultSet; 106 } 107 108 public boolean absolute(int row) throws SQLException 109 { 110 checkState(); 111 try 112 { 113 return resultSet.absolute(row); 114 } 115 catch (Throwable t) 116 { 117 throw checkException(t); 118 } 119 } 120 121 public void afterLast() throws SQLException 122 { 123 checkState(); 124 try 125 { 126 resultSet.afterLast(); 127 } 128 catch (Throwable t) 129 { 130 throw checkException(t); 131 } 132 } 133 134 public void beforeFirst() throws SQLException 135 { 136 checkState(); 137 try 138 { 139 resultSet.beforeFirst(); 140 } 141 catch (Throwable t) 142 { 143 throw checkException(t); 144 } 145 } 146 147 public void cancelRowUpdates() throws SQLException 148 { 149 checkState(); 150 try 151 { 152 resultSet.cancelRowUpdates(); 153 } 154 catch (Throwable t) 155 { 156 throw checkException(t); 157 } 158 } 159 160 public void clearWarnings() throws SQLException 161 { 162 checkState(); 163 try 164 { 165 resultSet.clearWarnings(); 166 } 167 catch (Throwable t) 168 { 169 throw checkException(t); 170 } 171 } 172 173 public void close() throws SQLException 174 { 175 synchronized (lock) 176 { 177 if (closed) 178 return; 179 closed = true; 180 } 181 statement.unregisterResultSet(this); 182 internalClose(); 183 } 184 185 public void deleteRow() throws SQLException 186 { 187 checkState(); 188 try 189 { 190 resultSet.deleteRow(); 191 } 192 catch (Throwable t) 193 { 194 throw checkException(t); 195 } 196 } 197 198 public int findColumn(String columnName) throws SQLException 199 { 200 checkState(); 201 try 202 { 203 return resultSet.findColumn(columnName); 204 } 205 catch (Throwable t) 206 { 207 throw checkException(t); 208 } 209 } 210 211 public boolean first() throws SQLException 212 { 213 checkState(); 214 try 215 { 216 return resultSet.first(); 217 } 218 catch (Throwable t) 219 { 220 throw checkException(t); 221 } 222 } 223 224 public Array getArray(int i) throws SQLException 225 { 226 checkState(); 227 try 228 { 229 return resultSet.getArray(i); 230 } 231 catch (Throwable t) 232 { 233 throw checkException(t); 234 } 235 } 236 237 public Array getArray(String colName) throws SQLException 238 { 239 checkState(); 240 try 241 { 242 return resultSet.getArray(colName); 243 } 244 catch (Throwable t) 245 { 246 throw checkException(t); 247 } 248 } 249 250 public InputStream getAsciiStream(int columnIndex) throws SQLException 251 { 252 checkState(); 253 try 254 { 255 return resultSet.getAsciiStream(columnIndex); 256 } 257 catch (Throwable t) 258 { 259 throw checkException(t); 260 } 261 } 262 263 public InputStream getAsciiStream(String columnName) throws SQLException 264 { 265 checkState(); 266 try 267 { 268 return resultSet.getAsciiStream(columnName); 269 } 270 catch (Throwable t) 271 { 272 throw checkException(t); 273 } 274 } 275 276 public BigDecimal getBigDecimal(int columnIndex) throws SQLException 277 { 278 checkState(); 279 try 280 { 281 return resultSet.getBigDecimal(columnIndex); 282 } 283 catch (Throwable t) 284 { 285 throw checkException(t); 286 } 287 } 288 289 292 public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException 293 { 294 checkState(); 295 try 296 { 297 return resultSet.getBigDecimal(columnIndex, scale); 298 } 299 catch (Throwable t) 300 { 301 throw checkException(t); 302 } 303 } 304 305 public BigDecimal getBigDecimal(String columnName) throws SQLException 306 { 307 checkState(); 308 try 309 { 310 return resultSet.getBigDecimal(columnName); 311 } 312 catch (Throwable t) 313 { 314 throw checkException(t); 315 } 316 } 317 318 321 public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException 322 { 323 checkState(); 324 try 325 { 326 return resultSet.getBigDecimal(columnName, scale); 327 } 328 catch (Throwable t) 329 { 330 throw checkException(t); 331 } 332 } 333 334 public InputStream getBinaryStream(int columnIndex) throws SQLException 335 { 336 checkState(); 337 try 338 { 339 return resultSet.getBinaryStream(columnIndex); 340 } 341 catch (Throwable t) 342 { 343 throw checkException(t); 344 } 345 } 346 347 public InputStream getBinaryStream(String columnName) throws SQLException 348 { 349 checkState(); 350 try 351 { 352 return resultSet.getBinaryStream(columnName); 353 } 354 catch (Throwable t) 355 { 356 throw checkException(t); 357 } 358 } 359 360 public Blob getBlob(int i) throws SQLException 361 { 362 checkState(); 363 try 364 { 365 return resultSet.getBlob(i); 366 } 367 catch (Throwable t) 368 { 369 throw checkException(t); 370 } 371 } 372 373 public Blob getBlob(String colName) throws SQLException 374 { 375 checkState(); 376 try 377 { 378 return resultSet.getBlob(colName); 379 } 380 catch (Throwable t) 381 { 382 throw checkException(t); 383 } 384 } 385 386 public boolean getBoolean(int columnIndex) throws SQLException 387 { 388 checkState(); 389 try 390 { 391 return resultSet.getBoolean(columnIndex); 392 } 393 catch (Throwable t) 394 { 395 throw checkException(t); 396 } 397 } 398 399 public boolean getBoolean(String columnName) throws SQLException 400 { 401 checkState(); 402 try 403 { 404 return resultSet.getBoolean(columnName); 405 } 406 catch (Throwable t) 407 { 408 throw checkException(t); 409 } 410 } 411 412 public byte getByte(int columnIndex) throws SQLException 413 { 414 checkState(); 415 try 416 { 417 return resultSet.getByte(columnIndex); 418 } 419 catch (Throwable t) 420 { 421 throw checkException(t); 422 } 423 } 424 425 public byte getByte(String columnName) throws SQLException 426 { 427 checkState(); 428 try 429 { 430 return resultSet.getByte(columnName); 431 } 432 catch (Throwable t) 433 { 434 throw checkException(t); 435 } 436 } 437 438 public byte[] getBytes(int columnIndex) throws SQLException 439 { 440 checkState(); 441 try 442 { 443 return resultSet.getBytes(columnIndex); 444 } 445 catch (Throwable t) 446 { 447 throw checkException(t); 448 } 449 } 450 451 public byte[] getBytes(String columnName) throws SQLException 452 { 453 checkState(); 454 try 455 { 456 return resultSet.getBytes(columnName); 457 } 458 catch (Throwable t) 459 { 460 throw checkException(t); 461 } 462 } 463 464 public Reader getCharacterStream(int columnIndex) throws SQLException 465 { 466 checkState(); 467 try 468 { 469 return resultSet.getCharacterStream(columnIndex); 470 } 471 catch (Throwable t) 472 { 473 throw checkException(t); 474 } 475 } 476 477 public Reader getCharacterStream(String columnName) throws SQLException 478 { 479 checkState(); 480 try 481 { 482 return resultSet.getCharacterStream(columnName); 483 } 484 catch (Throwable t) 485 { 486 throw checkException(t); 487 } 488 } 489 490 public Clob getClob(int i) throws SQLException 491 { 492 checkState(); 493 try 494 { 495 return resultSet.getClob(i); 496 } 497 catch (Throwable t) 498 { 499 throw checkException(t); 500 } 501 } 502 503 public Clob getClob(String colName) throws SQLException 504 { 505 checkState(); 506 try 507 { 508 return resultSet.getClob(colName); 509 } 510 catch (Throwable t) 511 { 512 throw checkException(t); 513 } 514 } 515 516 public int getConcurrency() throws SQLException 517 { 518 checkState(); 519 try 520 { 521 return resultSet.getConcurrency(); 522 } 523 catch (Throwable t) 524 { 525 throw checkException(t); 526 } 527 } 528 529 public String getCursorName() throws SQLException 530 { 531 checkState(); 532 try 533 { 534 return resultSet.getCursorName(); 535 } 536 catch (Throwable t) 537 { 538 throw checkException(t); 539 } 540 } 541 542 public Date getDate(int columnIndex) throws SQLException 543 { 544 checkState(); 545 try 546 { 547 return resultSet.getDate(columnIndex); 548 } 549 catch (Throwable t) 550 { 551 throw checkException(t); 552 } 553 } 554 555 public Date getDate(int columnIndex, Calendar cal) throws SQLException 556 { 557 checkState(); 558 try 559 { 560 return resultSet.getDate(columnIndex, cal); 561 } 562 catch (Throwable t) 563 { 564 throw checkException(t); 565 } 566 } 567 568 public Date getDate(String columnName) throws SQLException 569 { 570 checkState(); 571 try 572 { 573 return resultSet.getDate(columnName); 574 } 575 catch (Throwable t) 576 { 577 throw checkException(t); 578 } 579 } 580 581 public Date getDate(String columnName, Calendar cal) throws SQLException 582 { 583 checkState(); 584 try 585 { 586 return resultSet.getDate(columnName, cal); 587 } 588 catch (Throwable t) 589 { 590 throw checkException(t); 591 } 592 } 593 594 public double getDouble(int columnIndex) throws SQLException 595 { 596 checkState(); 597 try 598 { 599 return resultSet.getDouble(columnIndex); 600 } 601 catch (Throwable t) 602 { 603 throw checkException(t); 604 } 605 } 606 607 public double getDouble(String columnName) throws SQLException 608 { 609 checkState(); 610 try 611 { 612 return resultSet.getDouble(columnName); 613 } 614 catch (Throwable t) 615 { 616 throw checkException(t); 617 } 618 } 619 620 public int getFetchDirection() throws SQLException 621 { 622 checkState(); 623 try 624 { 625 return resultSet.getFetchDirection(); 626 } 627 catch (Throwable t) 628 { 629 throw checkException(t); 630 } 631 } 632 633 public int getFetchSize() throws SQLException 634 { 635 checkState(); 636 try 637 { 638 return resultSet.getFetchSize(); 639 } 640 catch (Throwable t) 641 { 642 throw checkException(t); 643 } 644 } 645 646 public float getFloat(int columnIndex) throws SQLException 647 { 648 checkState(); 649 try 650 { 651 return resultSet.getFloat(columnIndex); 652 } 653 catch (Throwable t) 654 { 655 throw checkException(t); 656 } 657 } 658 659 public float getFloat(String columnName) throws SQLException 660 { 661 checkState(); 662 try 663 { 664 return resultSet.getFloat(columnName); 665 } 666 catch (Throwable t) 667 { 668 throw checkException(t); 669 } 670 } 671 672 public int getInt(int columnIndex) throws SQLException 673 { 674 checkState(); 675 try 676 { 677 return resultSet.getInt(columnIndex); 678 } 679 catch (Throwable t) 680 { 681 throw checkException(t); 682 } 683 } 684 685 public int getInt(String columnName) throws SQLException 686 { 687 checkState(); 688 try 689 { 690 return resultSet.getInt(columnName); 691 } 692 catch (Throwable t) 693 { 694 throw checkException(t); 695 } 696 } 697 698 public long getLong(int columnIndex) throws SQLException 699 { 700 checkState(); 701 try 702 { 703 return resultSet.getLong(columnIndex); 704 } 705 catch (Throwable t) 706 { 707 throw checkException(t); 708 } 709 } 710 711 public long getLong(String columnName) throws SQLException 712 { 713 checkState(); 714 try 715 { 716 return resultSet.getLong(columnName); 717 } 718 catch (Throwable t) 719 { 720 throw checkException(t); 721 } 722 } 723 724 public ResultSetMetaData getMetaData() throws SQLException 725 { 726 checkState(); 727 try 728 { 729 return resultSet.getMetaData(); 730 } 731 catch (Throwable t) 732 { 733 throw checkException(t); 734 } 735 } 736 737 public Object getObject(int columnIndex) throws SQLException 738 { 739 checkState(); 740 try 741 { 742 return resultSet.getObject(columnIndex); 743 } 744 catch (Throwable t) 745 { 746 throw checkException(t); 747 } 748 } 749 750 public Object getObject(int i, Map map) throws SQLException 751 { 752 checkState(); 753 try 754 { 755 return resultSet.getObject(i, map); 756 } 757 catch (Throwable t) 758 { 759 throw checkException(t); 760 } 761 } 762 763 public Object getObject(String columnName) throws SQLException 764 { 765 checkState(); 766 try 767 { 768 return resultSet.getObject(columnName); 769 } 770 catch (Throwable t) 771 { 772 throw checkException(t); 773 } 774 } 775 776 public Object getObject(String colName, Map map) throws SQLException 777 { 778 checkState(); 779 try 780 { 781 return resultSet.getObject(colName, map); 782 } 783 catch (Throwable t) 784 { 785 throw checkException(t); 786 } 787 } 788 789 public Ref getRef(int i) throws SQLException 790 { 791 checkState(); 792 try 793 { 794 return resultSet.getRef(i); 795 } 796 catch (Throwable t) 797 { 798 throw checkException(t); 799 } 800 } 801 802 public Ref getRef(String colName) throws SQLException 803 { 804 checkState(); 805 try 806 { 807 return resultSet.getRef(colName); 808 } 809 catch (Throwable t) 810 { 811 throw checkException(t); 812 } 813 } 814 815 public int getRow() throws SQLException 816 { 817 checkState(); 818 try 819 { 820 return resultSet.getRow(); 821 } 822 catch (Throwable t) 823 { 824 throw checkException(t); 825 } 826 } 827 828 public short getShort(int columnIndex) throws SQLException 829 { 830 checkState(); 831 try 832 { 833 return resultSet.getShort(columnIndex); 834 } 835 catch (Throwable t) 836 { 837 throw checkException(t); 838 } 839 } 840 841 public short getShort(String columnName) throws SQLException 842 { 843 checkState(); 844 try 845 { 846 return resultSet.getShort(columnName); 847 } 848 catch (Throwable t) 849 { 850 throw checkException(t); 851 } 852 } 853 854 public Statement getStatement() throws SQLException 855 { 856 checkState(); 857 return statement; 858 } 859 860 public String getString(int columnIndex) throws SQLException 861 { 862 checkState(); 863 try 864 { 865 return resultSet.getString(columnIndex); 866 } 867 catch (Throwable t) 868 { 869 throw checkException(t); 870 } 871 } 872 873 public String getString(String columnName) throws SQLException 874 { 875 checkState(); 876 try 877 { 878 return resultSet.getString(columnName); 879 } 880 catch (Throwable t) 881 { 882 throw checkException(t); 883 } 884 } 885 886 public Time getTime(int columnIndex) throws SQLException 887 { 888 checkState(); 889 try 890 { 891 return resultSet.getTime(columnIndex); 892 } 893 catch (Throwable t) 894 { 895 throw checkException(t); 896 } 897 } 898 899 public Time getTime(int columnIndex, Calendar cal) throws SQLException 900 { 901 checkState(); 902 try 903 { 904 return resultSet.getTime(columnIndex, cal); 905 } 906 catch (Throwable t) 907 { 908 throw checkException(t); 909 } 910 } 911 912 public Time getTime(String columnName) throws SQLException 913 { 914 checkState(); 915 try 916 { 917 return resultSet.getTime(columnName); 918 } 919 catch (Throwable t) 920 { 921 throw checkException(t); 922 } 923 } 924 925 public Time getTime(String columnName, Calendar cal) throws SQLException 926 { 927 checkState(); 928 try 929 { 930 return resultSet.getTime(columnName, cal); 931 } 932 catch (Throwable t) 933 { 934 throw checkException(t); 935 } 936 } 937 938 public Timestamp getTimestamp(int columnIndex) throws SQLException 939 { 940 checkState(); 941 try 942 { 943 return resultSet.getTimestamp(columnIndex); 944 } 945 catch (Throwable t) 946 { 947 throw checkException(t); 948 } 949 } 950 951 public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException 952 { 953 checkState(); 954 try 955 { 956 return resultSet.getTimestamp(columnIndex, cal); 957 } 958 catch (Throwable t) 959 { 960 throw checkException(t); 961 } 962 } 963 964 public Timestamp getTimestamp(String columnName) throws SQLException 965 { 966 checkState(); 967 try 968 { 969 return resultSet.getTimestamp(columnName); 970 } 971 catch (Throwable t) 972 { 973 throw checkException(t); 974 } 975 } 976 977 public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException 978 { 979 checkState(); 980 try 981 { 982 return resultSet.getTimestamp(columnName, cal); 983 } 984 catch (Throwable t) 985 { 986 throw checkException(t); 987 } 988 } 989 990 public int getType() throws SQLException 991 { 992 checkState(); 993 try 994 { 995 return resultSet.getType(); 996 } 997 catch (Throwable t) 998 { 999 throw checkException(t); 1000 } 1001 } 1002 1003 1006 public InputStream getUnicodeStream(int columnIndex) throws SQLException 1007 { 1008 checkState(); 1009 try 1010 { 1011 return resultSet.getUnicodeStream(columnIndex); 1012 } 1013 catch (Throwable t) 1014 { 1015 throw checkException(t); 1016 } 1017 } 1018 1019 1022 public InputStream getUnicodeStream(String columnName) throws SQLException 1023 { 1024 try 1025 { 1026 return resultSet.getUnicodeStream(columnName); 1027 } 1028 catch (Throwable t) 1029 { 1030 throw checkException(t); 1031 } 1032 } 1033 1034 public URL getURL(int columnIndex) throws SQLException 1035 { 1036 checkState(); 1037 try 1038 { 1039 return resultSet.getURL(columnIndex); 1040 } 1041 catch (Throwable t) 1042 { 1043 throw checkException(t); 1044 } 1045 } 1046 1047 public URL getURL(String columnName) throws SQLException 1048 { 1049 checkState(); 1050 try 1051 { 1052 return resultSet.getURL(columnName); 1053 } 1054 catch (Throwable t) 1055 { 1056 throw checkException(t); 1057 } 1058 } 1059 1060 public SQLWarning getWarnings() throws SQLException 1061 { 1062 checkState(); 1063 try 1064 { 1065 return resultSet.getWarnings(); 1066 } 1067 catch (Throwable t) 1068 { 1069 throw checkException(t); 1070 } 1071 } 1072 1073 public void insertRow() throws SQLException 1074 { 1075 checkState(); 1076 try 1077 { 1078 resultSet.insertRow(); 1079 } 1080 catch (Throwable t) 1081 { 1082 throw checkException(t); 1083 } 1084 } 1085 1086 public boolean isAfterLast() throws SQLException 1087 { 1088 checkState(); 1089 try 1090 { 1091 return resultSet.isAfterLast(); 1092 } 1093 catch (Throwable t) 1094 { 1095 throw checkException(t); 1096 } 1097 } 1098 1099 public boolean isBeforeFirst() throws SQLException 1100 { 1101 checkState(); 1102 try 1103 { 1104 return resultSet.isBeforeFirst(); 1105 } 1106 catch (Throwable t) 1107 { 1108 throw checkException(t); 1109 } 1110 } 1111 1112 public boolean isFirst() throws SQLException 1113 { 1114 checkState(); 1115 try 1116 { 1117 return resultSet.isFirst(); 1118 } 1119 catch (Throwable t) 1120 { 1121 throw checkException(t); 1122 } 1123 } 1124 1125 public boolean isLast() throws SQLException 1126 { 1127 checkState(); 1128 try 1129 { 1130 return resultSet.isLast(); 1131 } 1132 catch (Throwable t) 1133 { 1134 throw checkException(t); 1135 } 1136 } 1137 1138 public boolean last() throws SQLException 1139 { 1140 checkState(); 1141 try 1142 { 1143 return resultSet.last(); 1144 } 1145 catch (Throwable t) 1146 { 1147 throw checkException(t); 1148 } 1149 } 1150 1151 public void moveToCurrentRow() throws SQLException 1152 { 1153 checkState(); 1154 try 1155 { 1156 resultSet.moveToCurrentRow(); 1157 } 1158 catch (Throwable t) 1159 { 1160 throw checkException(t); 1161 } 1162 } 1163 1164 public void moveToInsertRow() throws SQLException 1165 { 1166 checkState(); 1167 try 1168 { 1169 resultSet.moveToInsertRow(); 1170 } 1171 catch (Throwable t) 1172 { 1173 throw checkException(t); 1174 } 1175 } 1176 1177 public boolean next() throws SQLException 1178 { 1179 checkState(); 1180 try 1181 { 1182 return resultSet.next(); 1183 } 1184 catch (Throwable t) 1185 { 1186 throw checkException(t); 1187 } 1188 } 1189 1190 public boolean previous() throws SQLException 1191 { 1192 checkState(); 1193 try 1194 { 1195 return resultSet.previous(); 1196 } 1197 catch (Throwable t) 1198 { 1199 throw checkException(t); 1200 } 1201 } 1202 1203 public void refreshRow() throws SQLException 1204 { 1205 checkState(); 1206 try 1207 { 1208 resultSet.refreshRow(); 1209 } 1210 catch (Throwable t) 1211 { 1212 throw checkException(t); 1213 } 1214 } 1215 1216 public boolean relative(int rows) throws SQLException 1217 { 1218 checkState(); 1219 try 1220 { 1221 return resultSet.relative(rows); 1222 } 1223 catch (Throwable t) 1224 { 1225 throw checkException(t); 1226 } 1227 } 1228 1229 public boolean rowDeleted() throws SQLException 1230 { 1231 checkState(); 1232 try 1233 { 1234 return resultSet.rowDeleted(); 1235 } 1236 catch (Throwable t) 1237 { 1238 throw checkException(t); 1239 } 1240 } 1241 1242 public boolean rowInserted() throws SQLException 1243 { 1244 checkState(); 1245 try 1246 { 1247 return resultSet.rowInserted(); 1248 } 1249 catch (Throwable t) 1250 { 1251 throw checkException(t); 1252 } 1253 } 1254 1255 public boolean rowUpdated() throws SQLException 1256 { 1257 checkState(); 1258 try 1259 { 1260 return resultSet.rowUpdated(); 1261 } 1262 catch (Throwable t) 1263 { 1264 throw checkException(t); 1265 } 1266 } 1267 1268 public void setFetchDirection(int direction) throws SQLException 1269 { 1270 checkState(); 1271 try 1272 { 1273 resultSet.setFetchDirection(direction); 1274 } 1275 catch (Throwable t) 1276 { 1277 throw checkException(t); 1278 } 1279 } 1280 1281 public void setFetchSize(int rows) throws SQLException 1282 { 1283 checkState(); 1284 try 1285 { 1286 resultSet.setFetchSize(rows); 1287 } 1288 catch (Throwable t) 1289 { 1290 throw checkException(t); 1291 } 1292 } 1293 1294 public void updateArray(int columnIndex, Array x) throws SQLException 1295 { 1296 checkState(); 1297 try 1298 { 1299 resultSet.updateArray(columnIndex, x); 1300 } 1301 catch (Throwable t) 1302 { 1303 throw checkException(t); 1304 } 1305 } 1306 1307 public void updateArray(String columnName, Array x) throws SQLException 1308 { 1309 checkState(); 1310 try 1311 { 1312 resultSet.updateArray(columnName, x); 1313 } 1314 catch (Throwable t) 1315 { 1316 throw checkException(t); 1317 } 1318 } 1319 1320 public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException 1321 { 1322 checkState(); 1323 try 1324 { 1325 resultSet.updateAsciiStream(columnIndex, x, length); 1326 } 1327 catch (Throwable t) 1328 { 1329 throw checkException(t); 1330 } 1331 } 1332 1333 public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException 1334 { 1335 checkState(); 1336 try 1337 { 1338 resultSet.updateAsciiStream(columnName, x, length); 1339 } 1340 catch (Throwable t) 1341 { 1342 throw checkException(t); 1343 } 1344 } 1345 1346 public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException 1347 { 1348 checkState(); 1349 try 1350 { 1351 resultSet.updateBigDecimal(columnIndex, x); 1352 } 1353 catch (Throwable t) 1354 { 1355 throw checkException(t); 1356 } 1357 } 1358 1359 public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException 1360 { 1361 checkState(); 1362 try 1363 { 1364 resultSet.updateBigDecimal(columnName, x); 1365 } 1366 catch (Throwable t) 1367 { 1368 throw checkException(t); 1369 } 1370 } 1371 1372 public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException 1373 { 1374 checkState(); 1375 try 1376 { 1377 resultSet.updateBinaryStream(columnIndex, x, length); 1378 } 1379 catch (Throwable t) 1380 { 1381 throw checkException(t); 1382 } 1383 } 1384 1385 public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException 1386 { 1387 checkState(); 1388 try 1389 { 1390 resultSet.updateBinaryStream(columnName, x, length); 1391 } 1392 catch (Throwable t) 1393 { 1394 throw checkException(t); 1395 } 1396 } 1397 1398 public void updateBlob(int columnIndex, Blob x) throws SQLException 1399 { 1400 checkState(); 1401 try 1402 { 1403 resultSet.updateBlob(columnIndex, x); 1404 } 1405 catch (Throwable t) 1406 { 1407 throw checkException(t); 1408 } 1409 } 1410 1411 public void updateBlob(String columnName, Blob x) throws SQLException 1412 { 1413 checkState(); 1414 try 1415 { 1416 resultSet.updateBlob(columnName, x); 1417 } 1418 catch (Throwable t) 1419 { 1420 throw checkException(t); 1421 } 1422 } 1423 1424 public void updateBoolean(int columnIndex, boolean x) throws SQLException 1425 { 1426 checkState(); 1427 try 1428 { 1429 resultSet.updateBoolean(columnIndex, x); 1430 } 1431 catch (Throwable t) 1432 { 1433 throw checkException(t); 1434 } 1435 } 1436 1437 public void updateBoolean(String columnName, boolean x) throws SQLException 1438 { 1439 checkState(); 1440 try 1441 { 1442 resultSet.updateBoolean(columnName, x); 1443 } 1444 catch (Throwable t) 1445 { 1446 throw checkException(t); 1447 } 1448 } 1449 1450 public void updateByte(int columnIndex, byte x) throws SQLException 1451 { 1452 checkState(); 1453 try 1454 { 1455 resultSet.updateByte(columnIndex, x); 1456 } 1457 catch (Throwable t) 1458 { 1459 throw checkException(t); 1460 } 1461 } 1462 1463 public void updateByte(String columnName, byte x) throws SQLException 1464 { 1465 checkState(); 1466 try 1467 { 1468 resultSet.updateByte(columnName, x); 1469 } 1470 catch (Throwable t) 1471 { 1472 throw checkException(t); 1473 } 1474 } 1475 1476 public void updateBytes(int columnIndex, byte[] x) throws SQLException 1477 { 1478 checkState(); 1479 try 1480 { 1481 resultSet.updateBytes(columnIndex, x); 1482 } 1483 catch (Throwable t) 1484 { 1485 throw checkException(t); 1486 } 1487 } 1488 1489 public void updateBytes(String columnName, byte[] x) throws SQLException 1490 { 1491 checkState(); 1492 try 1493 { 1494 resultSet.updateBytes(columnName, x); 1495 } 1496 catch (Throwable t) 1497 { 1498 throw checkException(t); 1499 } 1500 } 1501 1502 public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException 1503 { 1504 checkState(); 1505 try 1506 { 1507 resultSet.updateCharacterStream(columnIndex, x, length); 1508 } 1509 catch (Throwable t) 1510 { 1511 throw checkException(t); 1512 } 1513 } 1514 1515 public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException 1516 { 1517 checkState(); 1518 try 1519 { 1520 resultSet.updateCharacterStream(columnName, reader, length); 1521 } 1522 catch (Throwable t) 1523 { 1524 throw checkException(t); 1525 } 1526 } 1527 1528 public void updateClob(int columnIndex, Clob x) throws SQLException 1529 { 1530 checkState(); 1531 try 1532 { 1533 resultSet.updateClob(columnIndex, x); 1534 } 1535 catch (Throwable t) 1536 { 1537 throw checkException(t); 1538 } 1539 } 1540 1541 public void updateClob(String columnName, Clob x) throws SQLException 1542 { 1543 checkState(); 1544 try 1545 { 1546 resultSet.updateClob(columnName, x); 1547 } 1548 catch (Throwable t) 1549 { 1550 throw checkException(t); 1551 } 1552 } 1553 1554 public void updateDate(int columnIndex, Date x) throws SQLException 1555 { 1556 checkState(); 1557 try 1558 { 1559 resultSet.updateDate(columnIndex, x); 1560 } 1561 catch (Throwable t) 1562 { 1563 throw checkException(t); 1564 } 1565 } 1566 1567 public void updateDate(String columnName, Date x) throws SQLException 1568 { 1569 checkState(); 1570 try 1571 { 1572 resultSet.updateDate(columnName, x); 1573 } 1574 catch (Throwable t) 1575 { 1576 throw checkException(t); 1577 } 1578 } 1579 1580 public void updateDouble(int columnIndex, double x) throws SQLException 1581 { 1582 checkState(); 1583 try 1584 { 1585 resultSet.updateDouble(columnIndex, x); 1586 } 1587 catch (Throwable t) 1588 { 1589 throw checkException(t); 1590 } 1591 } 1592 1593 public void updateDouble(String columnName, double x) throws SQLException 1594 { 1595 checkState(); 1596 try 1597 { 1598 resultSet.updateDouble(columnName, x); 1599 } 1600 catch (Throwable t) 1601 { 1602 throw checkException(t); 1603 } 1604 } 1605 1606 public void updateFloat(int columnIndex, float x) throws SQLException 1607 { 1608 checkState(); 1609 try 1610 { 1611 resultSet.updateFloat(columnIndex, x); 1612 } 1613 catch (Throwable t) 1614 { 1615 throw checkException(t); 1616 } 1617 } 1618 1619 public void updateFloat(String columnName, float x) throws SQLException 1620 { 1621 checkState(); 1622 try 1623 { 1624 resultSet.updateFloat(columnName, x); 1625 } 1626 catch (Throwable t) 1627 { 1628 throw checkException(t); 1629 } 1630 } 1631 1632 public void updateInt(int columnIndex, int x) throws SQLException 1633 { 1634 checkState(); 1635 try 1636 { 1637 resultSet.updateInt(columnIndex, x); 1638 } 1639 catch (Throwable t) 1640 { 1641 throw checkException(t); 1642 } 1643 } 1644 1645 public void updateInt(String columnName, int x) throws SQLException 1646 { 1647 checkState(); 1648 try 1649 { 1650 resultSet.updateInt(columnName, x); 1651 } 1652 catch (Throwable t) 1653 { 1654 throw checkException(t); 1655 } 1656 } 1657 1658 public void updateLong(int columnIndex, long x) throws SQLException 1659 { 1660 checkState(); 1661 try 1662 { 1663 resultSet.updateLong(columnIndex, x); 1664 } 1665 catch (Throwable t) 1666 { 1667 throw checkException(t); 1668 } 1669 } 1670 1671 public void updateLong(String columnName, long x) throws SQLException 1672 { 1673 checkState(); 1674 try 1675 { 1676 resultSet.updateLong(columnName, x); 1677 } 1678 catch (Throwable t) 1679 { 1680 throw checkException(t); 1681 } 1682 } 1683 1684 public void updateNull(int columnIndex) throws SQLException 1685 { 1686 checkState(); 1687 try 1688 { 1689 resultSet.updateNull(columnIndex); 1690 } 1691 catch (Throwable t) 1692 { 1693 throw checkException(t); 1694 } 1695 } 1696 1697 public void updateNull(String columnName) throws SQLException 1698 { 1699 checkState(); 1700 try 1701 { 1702 resultSet.updateNull(columnName); 1703 } 1704 catch (Throwable t) 1705 { 1706 throw checkException(t); 1707 } 1708 } 1709 1710 public void updateObject(int columnIndex, Object x) throws SQLException 1711 { 1712 checkState(); 1713 try 1714 { 1715 resultSet.updateObject(columnIndex, x); 1716 } 1717 catch (Throwable t) 1718 { 1719 throw checkException(t); 1720 } 1721 } 1722 1723 public void updateObject(int columnIndex, Object x, int scale) throws SQLException 1724 { 1725 checkState(); 1726 try 1727 { 1728 resultSet.updateObject(columnIndex, x, scale); 1729 } 1730 catch (Throwable t) 1731 { 1732 throw checkException(t); 1733 } 1734 } 1735 1736 public void updateObject(String columnName, Object x) throws SQLException 1737 { 1738 checkState(); 1739 try 1740 { 1741 resultSet.updateObject(columnName, x); 1742 } 1743 catch (Throwable t) 1744 { 1745 throw checkException(t); 1746 } 1747 } 1748 1749 public void updateObject(String columnName, Object x, int scale) throws SQLException 1750 { 1751 checkState(); 1752 try 1753 { 1754 resultSet.updateObject(columnName, x, scale); 1755 } 1756 catch (Throwable t) 1757 { 1758 throw checkException(t); 1759 } 1760 } 1761 1762 public void updateRef(int columnIndex, Ref x) throws SQLException 1763 { 1764 checkState(); 1765 try 1766 { 1767 resultSet.updateRef(columnIndex, x); 1768 } 1769 catch (Throwable t) 1770 { 1771 throw checkException(t); 1772 } 1773 } 1774 1775 public void updateRef(String columnName, Ref x) throws SQLException 1776 { 1777 checkState(); 1778 try 1779 { 1780 resultSet.updateRef(columnName, x); 1781 } 1782 catch (Throwable t) 1783 { 1784 throw checkException(t); 1785 } 1786 } 1787 1788 public void updateRow() throws SQLException 1789 { 1790 checkState(); 1791 try 1792 { 1793 resultSet.updateRow(); 1794 } 1795 catch (Throwable t) 1796 { 1797 throw checkException(t); 1798 } 1799 } 1800 1801 public void updateShort(int columnIndex, short x) throws SQLException 1802 { 1803 checkState(); 1804 try 1805 { 1806 resultSet.updateShort(columnIndex, x); 1807 } 1808 catch (Throwable t) 1809 { 1810 throw checkException(t); 1811 } 1812 } 1813 1814 public void updateShort(String columnName, short x) throws SQLException 1815 { 1816 checkState(); 1817 try 1818 { 1819 resultSet.updateShort(columnName, x); 1820 } 1821 catch (Throwable t) 1822 { 1823 throw checkException(t); 1824 } 1825 } 1826 1827 public void updateString(int columnIndex, String x) throws SQLException 1828 { 1829 checkState(); 1830 try 1831 { 1832 resultSet.updateString(columnIndex, x); 1833 } 1834 catch (Throwable t) 1835 { 1836 throw checkException(t); 1837 } 1838 } 1839 1840 public void updateString(String columnName, String x) throws SQLException 1841 { 1842 checkState(); 1843 try 1844 { 1845 resultSet.updateString(columnName, x); 1846 } 1847 catch (Throwable t) 1848 { 1849 throw checkException(t); 1850 } 1851 } 1852 1853 public void updateTime(int columnIndex, Time x) throws SQLException 1854 { 1855 checkState(); 1856 try 1857 { 1858 resultSet.updateTime(columnIndex, x); 1859 } 1860 catch (Throwable t) 1861 { 1862 throw checkException(t); 1863 } 1864 } 1865 1866 public void updateTime(String columnName, Time x) throws SQLException 1867 { 1868 checkState(); 1869 try 1870 { 1871 resultSet.updateTime(columnName, x); 1872 } 1873 catch (Throwable t) 1874 { 1875 throw checkException(t); 1876 } 1877 } 1878 1879 public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException 1880 { 1881 checkState(); 1882 try 1883 { 1884 resultSet.updateTimestamp(columnIndex, x); 1885 } 1886 catch (Throwable t) 1887 { 1888 throw checkException(t); 1889 } 1890 } 1891 1892 public void updateTimestamp(String columnName, Timestamp x) throws SQLException 1893 { 1894 checkState(); 1895 try 1896 { 1897 resultSet.updateTimestamp(columnName, x); 1898 } 1899 catch (Throwable t) 1900 { 1901 throw checkException(t); 1902 } 1903 } 1904 1905 public boolean wasNull() throws SQLException 1906 { 1907 checkState(); 1908 try 1909 { 1910 return resultSet.wasNull(); 1911 } 1912 catch (Throwable t) 1913 { 1914 throw checkException(t); 1915 } 1916 } 1917 1918 SQLException checkException(Throwable t) throws SQLException 1919 { 1920 throw statement.checkException(t); 1921 } 1922 1923 void internalClose() throws SQLException 1924 { 1925 synchronized (lock) 1926 { 1927 closed = true; 1928 } 1929 resultSet.close(); 1930 } 1931 1932 void checkState() throws SQLException 1933 { 1934 synchronized (lock) 1935 { 1936 if (closed) 1937 throw new SQLException ("The result set is closed."); 1938 } 1939 } 1940} | Popular Tags |