1 21 22 package org.apache.derbyTesting.functionTests.tests.lang; 23 24 import java.sql.Connection ; 25 import java.sql.Statement ; 26 import java.sql.ResultSet ; 27 import java.sql.ResultSetMetaData ; 28 import java.sql.SQLException ; 29 import java.sql.SQLWarning ; 30 import java.math.BigDecimal ; 31 import java.sql.DriverManager ; 32 import java.net.URL ; 33 import java.util.Calendar ; 34 import java.sql.Ref ; 35 import java.sql.Blob ; 36 import java.sql.Clob ; 37 import java.sql.Array ; 38 39 62 public abstract class TableVTI implements ResultSet { 63 64 private String tableName; 65 private ResultSetMetaData rsmd ; 66 private int[] map; 67 public TableVTI(String tableName) throws SQLException { 68 this.tableName = tableName; 69 init(); 70 } 71 72 protected void init() throws SQLException { 73 Connection conn = DriverManager 74 .getConnection("jdbc:default:connection"); 75 Statement s = conn.createStatement(); 76 ResultSet rs = s.executeQuery("select * from " + tableName 77 + " where 1 = 0 "); 78 rsmd = rs.getMetaData(); 79 rs.close(); 80 s.close(); 81 82 map = getColumnMap(getVTIColumnNames()); 83 } 84 85 public final ResultSetMetaData getMetaData() { 86 return rsmd; 87 } 88 89 public final void close() { 90 } 91 92 protected int[] getColumnMap(String [] vtiNames) throws SQLException { 93 94 if (vtiNames == null) 95 return null; 96 97 int[] map = new int[vtiNames.length]; 98 int count = rsmd.getColumnCount(); 99 100 outer: for (int i = 0; i < vtiNames.length; i++) { 101 102 String vtiCol = vtiNames[i]; 103 if (vtiCol == null) 104 continue outer; 105 ; 106 107 for (int j = 1; j <= count; j++) { 108 if (vtiCol.equalsIgnoreCase(rsmd.getColumnName(j))) { 109 map[i] = j; 110 continue outer; 111 } 112 } 113 } 114 115 return map; 116 } 117 118 protected String [] getVTIColumnNames() { 119 return null; 120 } 121 122 126 131 public boolean wasNull() throws SQLException { 132 throw new SQLException ("wasNull"); 133 } 134 135 140 public String getString(int columnIndex) throws SQLException { 141 throw new SQLException ("getString"); 142 } 143 144 149 public boolean getBoolean(int columnIndex) throws SQLException { 150 throw new SQLException ("getBoolean"); 151 } 152 153 158 public byte getByte(int columnIndex) throws SQLException { 159 throw new SQLException ("getByte"); 160 } 161 162 167 public short getShort(int columnIndex) throws SQLException { 168 throw new SQLException ("getShort"); 169 } 170 171 176 public int getInt(int columnIndex) throws SQLException { 177 throw new SQLException ("getInt"); 178 } 179 180 185 public long getLong(int columnIndex) throws SQLException { 186 throw new SQLException ("getLong"); 187 } 188 189 194 public float getFloat(int columnIndex) throws SQLException { 195 throw new SQLException ("getFloat"); 196 } 197 198 203 public double getDouble(int columnIndex) throws SQLException { 204 throw new SQLException ("getDouble"); 205 } 206 207 212 public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { 213 throw new SQLException ("getBigDecimal"); 214 } 215 216 221 public byte[] getBytes(int columnIndex) throws SQLException { 222 throw new SQLException ("getBytes"); 223 } 224 225 230 public java.sql.Date getDate(int columnIndex) throws SQLException { 231 throw new SQLException ("getDate"); 232 } 233 234 239 public java.sql.Time getTime(int columnIndex) throws SQLException { 240 throw new SQLException ("getTime"); 241 } 242 243 248 public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException { 249 throw new SQLException ("getTimestamp"); 250 } 251 252 257 public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException { 258 throw new SQLException ("getAsciiStream"); 259 } 260 261 266 public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { 267 throw new SQLException ("getUnicodeStream"); 268 } 269 270 275 public java.io.InputStream getBinaryStream(int columnIndex) 276 throws SQLException { 277 throw new SQLException ("getBinaryStream"); 278 } 279 280 285 public String getString(String columnName) throws SQLException { 286 return getString(findColumn(columnName)); 287 } 288 289 294 public boolean getBoolean(String columnName) throws SQLException { 295 return getBoolean(findColumn(columnName)); 296 } 297 298 303 public byte getByte(String columnName) throws SQLException { 304 return getByte(findColumn(columnName)); 305 } 306 307 312 public short getShort(String columnName) throws SQLException { 313 return getShort(findColumn(columnName)); 314 } 315 316 321 public int getInt(String columnName) throws SQLException { 322 return getInt(findColumn(columnName)); 323 } 324 325 330 public long getLong(String columnName) throws SQLException { 331 return getLong(findColumn(columnName)); 332 } 333 334 339 public float getFloat(String columnName) throws SQLException { 340 return getFloat(findColumn(columnName)); 341 } 342 343 348 public double getDouble(String columnName) throws SQLException { 349 return getDouble(findColumn(columnName)); 350 } 351 352 357 public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { 358 return getBigDecimal(findColumn(columnName), scale); 359 } 360 361 366 public byte[] getBytes(String columnName) throws SQLException { 367 return getBytes(findColumn(columnName)); 368 } 369 370 375 public java.sql.Date getDate(String columnName) throws SQLException { 376 return getDate(findColumn(columnName)); 377 } 378 379 384 public java.sql.Time getTime(String columnName) throws SQLException { 385 return getTime(findColumn(columnName)); 386 } 387 388 393 public java.sql.Timestamp getTimestamp(String columnName) throws SQLException { 394 return getTimestamp(findColumn(columnName)); 395 } 396 397 402 public java.io.InputStream getAsciiStream(String columnName) throws SQLException { 403 throw new SQLException ("getAsciiStream"); 404 } 405 406 411 public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { 412 throw new SQLException ("getUnicodeStream"); 413 } 414 415 420 public java.io.InputStream getBinaryStream(String columnName) 421 throws SQLException { 422 throw new SQLException ("getBinaryStream"); 423 } 424 425 428 public SQLWarning getWarnings() throws SQLException { 429 return null; 430 } 431 432 435 public void clearWarnings() throws SQLException { 436 } 437 438 443 public String getCursorName() throws SQLException { 444 throw new SQLException ("getCursorName"); 445 } 446 447 452 public Object getObject(int columnIndex) throws SQLException { 453 throw new SQLException ("getObject"); 454 } 455 456 461 public Object getObject(String columnName) throws SQLException { 462 return getObject(findColumn(columnName)); 463 } 464 465 470 public int findColumn(String columnName) throws SQLException { 471 throw new SQLException ("findColumn"); 472 } 473 474 477 478 483 public java.io.Reader getCharacterStream(int columnIndex) 484 throws SQLException { 485 throw new SQLException ("getCharacterStream"); 486 } 487 488 493 public java.io.Reader getCharacterStream(String columnName) 494 throws SQLException { 495 throw new SQLException ("getCharacterStream"); 496 } 497 498 503 public BigDecimal getBigDecimal(int columnIndex) 504 throws SQLException { 505 throw new SQLException ("getBigDecimal"); 506 } 507 508 513 public BigDecimal getBigDecimal(String columnName) 514 throws SQLException { 515 return getBigDecimal(findColumn(columnName)); 516 } 517 518 523 public boolean isBeforeFirst() 524 throws SQLException { 525 throw new SQLException ("isBeforeFirst"); 526 } 527 528 533 public boolean isAfterLast() 534 throws SQLException { 535 throw new SQLException ("isAfterLast"); 536 } 537 538 543 public boolean isFirst() 544 throws SQLException { 545 throw new SQLException ("isFirst"); 546 } 547 548 553 public boolean isLast() 554 throws SQLException { 555 throw new SQLException ("isLast"); 556 } 557 558 563 public void beforeFirst() 564 throws SQLException { 565 throw new SQLException ("beforeFirst"); 566 } 567 568 573 public void afterLast() 574 throws SQLException { 575 throw new SQLException ("afterLast"); 576 } 577 578 583 public boolean first() 584 throws SQLException { 585 throw new SQLException ("first"); 586 } 587 588 593 public boolean last() 594 throws SQLException { 595 throw new SQLException ("last"); 596 } 597 598 603 public int getRow() 604 throws SQLException { 605 throw new SQLException ("getRow"); 606 } 607 608 613 public boolean absolute(int row) 614 throws SQLException { 615 throw new SQLException ("absolute"); 616 } 617 618 623 public boolean relative(int rows) 624 throws SQLException { 625 throw new SQLException ("relative"); 626 } 627 628 633 public boolean previous() 634 throws SQLException { 635 throw new SQLException ("previous"); 636 } 637 638 643 public void setFetchDirection(int direction) 644 throws SQLException { 645 throw new SQLException ("setFetchDirection"); 646 } 647 648 653 public int getFetchDirection() 654 throws SQLException { 655 throw new SQLException ("getFetchDirection"); 656 } 657 658 663 public void setFetchSize(int rows) 664 throws SQLException { 665 throw new SQLException ("setFetchSize"); 666 } 667 668 673 public int getFetchSize() 674 throws SQLException { 675 throw new SQLException ("getFetchSize"); 676 } 677 678 683 public int getType() 684 throws SQLException { 685 throw new SQLException ("getType"); 686 } 687 688 693 public int getConcurrency() 694 throws SQLException { 695 throw new SQLException ("getConcurrency"); 696 } 697 698 703 public boolean rowUpdated() 704 throws SQLException { 705 throw new SQLException ("rowUpdated"); 706 } 707 708 713 public boolean rowInserted() 714 throws SQLException { 715 throw new SQLException ("rowInserted"); 716 } 717 718 723 public boolean rowDeleted() 724 throws SQLException { 725 throw new SQLException ("rowDeleted"); 726 } 727 728 733 public void updateNull(int columnIndex) 734 throws SQLException { 735 throw new SQLException ("updateNull"); 736 } 737 738 743 public void updateBoolean(int columnIndex, boolean x) 744 throws SQLException { 745 throw new SQLException ("updateBoolean"); 746 } 747 748 753 public void updateByte(int columnIndex, byte x) 754 throws SQLException { 755 throw new SQLException ("updateByte"); 756 } 757 758 763 public void updateShort(int columnIndex, short x) 764 throws SQLException { 765 throw new SQLException ("updateShort"); 766 } 767 768 773 public void updateInt(int columnIndex, int x) 774 throws SQLException { 775 throw new SQLException ("updateInt"); 776 } 777 778 783 public void updateLong(int columnIndex, long x) 784 throws SQLException { 785 throw new SQLException ("updateLong"); 786 } 787 788 793 public void updateFloat(int columnIndex, float x) 794 throws SQLException { 795 throw new SQLException ("updateFloat"); 796 } 797 798 803 public void updateDouble(int columnIndex, double x) 804 throws SQLException { 805 throw new SQLException ("updateDouble"); 806 } 807 808 813 public void updateBigDecimal(int columnIndex, BigDecimal x) 814 throws SQLException { 815 throw new SQLException ("updateBigDecimal"); 816 } 817 818 823 public void updateString(int columnIndex, String x) 824 throws SQLException { 825 throw new SQLException ("updateString"); 826 } 827 828 833 public void updateBytes(int columnIndex, byte[] x) 834 throws SQLException { 835 throw new SQLException ("updateBytes"); 836 } 837 838 843 public void updateDate(int columnIndex, java.sql.Date x) 844 throws SQLException { 845 throw new SQLException ("updateDate"); 846 } 847 848 853 public void updateTime(int columnIndex, java.sql.Time x) 854 throws SQLException { 855 throw new SQLException ("updateTime"); 856 } 857 858 863 public void updateTimestamp(int columnIndex, java.sql.Timestamp x) 864 throws SQLException { 865 throw new SQLException ("updateTimestamp"); 866 } 867 868 873 public void updateAsciiStream(int columnIndex, 874 java.io.InputStream x, 875 int length) 876 throws SQLException { 877 throw new SQLException ("updateAsciiStream"); 878 } 879 880 885 public void updateBinaryStream(int columnIndex, 886 java.io.InputStream x, 887 int length) 888 throws SQLException { 889 throw new SQLException ("updateBinaryStream"); 890 } 891 892 897 public void updateCharacterStream(int columnIndex, 898 java.io.Reader x, 899 int length) 900 throws SQLException { 901 throw new SQLException ("updateCharacterStream"); 902 } 903 904 909 public void updateObject(int columnIndex, 910 Object x, 911 int scale) 912 throws SQLException { 913 throw new SQLException ("updateObject"); 914 } 915 916 921 public void updateObject(int columnIndex, Object x) 922 throws SQLException { 923 throw new SQLException ("updateObject"); 924 } 925 926 931 public void updateNull(String columnName) 932 throws SQLException { 933 throw new SQLException ("updateNull"); 934 } 935 936 941 public void updateBoolean(String columnName, boolean x) 942 throws SQLException { 943 throw new SQLException ("updateBoolean"); 944 } 945 946 951 public void updateByte(String columnName, byte x) 952 throws SQLException { 953 throw new SQLException ("updateByte"); 954 } 955 956 961 public void updateShort(String columnName, short x) 962 throws SQLException { 963 throw new SQLException ("updateShort"); 964 } 965 966 971 public void updateInt(String columnName, int x) 972 throws SQLException { 973 throw new SQLException ("updateInt"); 974 } 975 976 981 public void updateLong(String columnName, long x) 982 throws SQLException { 983 throw new SQLException ("updateLong"); 984 } 985 986 991 public void updateFloat(String columnName, float x) 992 throws SQLException { 993 throw new SQLException ("updateFloat"); 994 } 995 996 1001 public void updateDouble(String columnName, double x) 1002 throws SQLException { 1003 throw new SQLException ("updateDouble"); 1004 } 1005 1006 1011 public void updateBigDecimal(String columnName, BigDecimal x) 1012 throws SQLException { 1013 throw new SQLException ("updateBigDecimal"); 1014 } 1015 1016 1021 public void updateString(String columnName, String x) 1022 throws SQLException { 1023 throw new SQLException ("updateString"); 1024 } 1025 1026 1031 public void updateBytes(String columnName, byte[] x) 1032 throws SQLException { 1033 throw new SQLException ("updateBytes"); 1034 } 1035 1036 1041 public void updateDate(String columnName, java.sql.Date x) 1042 throws SQLException { 1043 throw new SQLException ("updateDate"); 1044 } 1045 1046 1051 public void updateTime(String columnName, java.sql.Time x) 1052 throws SQLException { 1053 throw new SQLException ("updateTime"); 1054 } 1055 1056 1061 public void updateTimestamp(String columnName, java.sql.Timestamp x) 1062 throws SQLException { 1063 throw new SQLException ("updateTimestamp"); 1064 } 1065 1066 1071 public void updateAsciiStream(String columnName, 1072 java.io.InputStream x, 1073 int length) 1074 throws SQLException { 1075 throw new SQLException ("updateAsciiStream"); 1076 } 1077 1078 1083 public void updateBinaryStream(String columnName, 1084 java.io.InputStream x, 1085 int length) 1086 throws SQLException { 1087 throw new SQLException ("updateBinaryStream"); 1088 } 1089 1090 1095 public void updateCharacterStream(String columnName, 1096 java.io.Reader x, 1097 int length) 1098 throws SQLException { 1099 throw new SQLException ("updateCharacterStream"); 1100 } 1101 1102 1107 public void updateObject(String columnName, 1108 Object x, 1109 int scale) 1110 throws SQLException { 1111 throw new SQLException ("updateObject"); 1112 } 1113 1114 1119 public void updateObject(String columnName, Object x) 1120 throws SQLException { 1121 throw new SQLException ("updateObject"); 1122 } 1123 1124 1129 public void insertRow() 1130 throws SQLException { 1131 throw new SQLException ("insertRow"); 1132 } 1133 1134 1139 public void updateRow() 1140 throws SQLException { 1141 throw new SQLException ("updateRow"); 1142 } 1143 1144 1149 public void deleteRow() 1150 throws SQLException { 1151 throw new SQLException ("deleteRow"); 1152 } 1153 1154 1159 public void refreshRow() 1160 throws SQLException { 1161 throw new SQLException ("refreshRow"); 1162 } 1163 1164 1169 public void cancelRowUpdates() 1170 throws SQLException { 1171 throw new SQLException ("cancelRowUpdates"); 1172 } 1173 1174 1179 public void moveToInsertRow() 1180 throws SQLException { 1181 throw new SQLException ("moveToInsertRow"); 1182 } 1183 1184 1189 public void moveToCurrentRow() 1190 throws SQLException { 1191 throw new SQLException ("moveToCurrentRow"); 1192 } 1193 1194 1199 public Statement getStatement() 1200 throws SQLException { 1201 throw new SQLException ("getStatement"); 1202 } 1203 1208 public java.sql.Date getDate(int columnIndex, Calendar cal) 1209 throws SQLException { 1210 throw new SQLException ("getDate"); 1211 } 1212 1213 1218 public java.sql.Date getDate(String columnName, Calendar cal) 1219 throws SQLException { 1220 throw new SQLException ("getDate"); 1221 } 1222 1223 1228 public java.sql.Time getTime(int columnIndex, Calendar cal) 1229 throws SQLException { 1230 throw new SQLException ("getTime"); 1231 } 1232 1233 1238 public java.sql.Time getTime(String columnName, Calendar cal) 1239 throws SQLException { 1240 throw new SQLException ("getTime"); 1241 } 1242 1243 1248 public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) 1249 throws SQLException { 1250 throw new SQLException ("getTimestamp"); 1251 } 1252 1253 1258 public java.sql.Timestamp getTimestamp(String columnName, Calendar cal) 1259 throws SQLException { 1260 throw new SQLException ("getTimestamp"); 1261 } 1262 1265 1266 1271 public URL getURL(int columnIndex) 1272 throws SQLException 1273 { 1274 throw new SQLException ("getURL"); 1275 } 1276 1277 1282 public URL getURL(String columnName) 1283 throws SQLException { 1284 throw new SQLException ("getURL"); 1285 } 1286 1287 1292 public Object getObject(int i, java.util.Map map) 1293 throws SQLException { 1294 throw new SQLException ("getObject"); 1295 } 1296 1297 1302 public Ref getRef(int i) 1303 throws SQLException { 1304 throw new SQLException ("getRef"); 1305 } 1306 1307 1312 public Blob getBlob(int i) 1313 throws SQLException { 1314 throw new SQLException ("getBlob"); 1315 } 1316 1317 1322 public Clob getClob(int i) 1323 throws SQLException { 1324 throw new SQLException ("getClob"); 1325 } 1326 1327 1332 public Array getArray(int i) 1333 throws SQLException { 1334 throw new SQLException ("getArray"); 1335 } 1336 1337 1342 public Object getObject(String colName, java.util.Map map) 1343 throws SQLException { 1344 throw new SQLException ("getObject"); 1345 } 1346 1347 1352 public Ref getRef(String colName) 1353 throws SQLException { 1354 throw new SQLException ("getRef"); 1355 } 1356 1357 1362 public Blob getBlob(String colName) 1363 throws SQLException { 1364 throw new SQLException ("getBlob"); 1365 } 1366 1367 1372 public Clob getClob(String colName) 1373 throws SQLException { 1374 throw new SQLException ("getClob"); 1375 } 1376 1377 1382 public Array getArray(String colName) 1383 throws SQLException { 1384 throw new SQLException ("getArray"); 1385 } 1386 1387 1388 1390 1395 public void updateRef(int columnIndex, Ref x) 1396 throws SQLException { 1397 throw new SQLException ("updateRef"); 1398 } 1399 1400 1405 public void updateRef(String columnName, Ref x) 1406 throws SQLException { 1407 throw new SQLException ("updateRef"); 1408 } 1409 1410 1415 public void updateBlob(int columnIndex, Blob x) 1416 throws SQLException { 1417 throw new SQLException ("updateBlob"); 1418 } 1419 1420 1425 public void updateBlob(String columnName, Blob x) 1426 throws SQLException { 1427 throw new SQLException ("updateBlob"); 1428 } 1429 1430 1435 public void updateClob(int columnIndex, Clob x) 1436 throws SQLException { 1437 throw new SQLException ("updateClob"); 1438 } 1439 1440 1445 public void updateClob(String columnName, Clob x) 1446 throws SQLException { 1447 throw new SQLException ("updateClob"); 1448 } 1449 1450 1455 public void updateArray(int columnIndex, Array x) 1456 throws SQLException { 1457 throw new SQLException ("updateArray"); 1458 } 1459 1460 1465 public void updateArray(String columnName, Array x) 1466 throws SQLException { 1467 throw new SQLException ("updateArray"); 1468 } 1469} 1470 | Popular Tags |