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