117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpepackage SQLite.JDBC2z; 2417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 3417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughesimport java.sql.*; 4417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughesimport java.math.BigDecimal; 5417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 6417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughespublic class JDBCResultSet implements java.sql.ResultSet { 7417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 8417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes /** 9417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * Current row to be retrieved. 10417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes */ 11417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private int row; 12417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 13417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes /** 14417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * Table returned by Database.get_table() 15417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes */ 16417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes protected SQLite.TableResult tr; 17417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 18417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes /** 19417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * Statement from which result set was produced. 20417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes */ 21417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private JDBCStatement s; 22417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 23417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes /** 24417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * Meta data for result set or null. 25417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes */ 267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private JDBCResultSetMetaData md; 27417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 28417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes /** 29417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * Last result cell retrieved or null. 30417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes */ 31417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private String lastg; 32417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes /** 347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes * Updatability of this result set. 357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes */ 367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private int updatable; 377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes /** 397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes * When updatable this is the table name. 407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes */ 417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private String uptable; 427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes /** 447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes * When updatable these are the PK column names of uptable. 457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes */ 467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private String pkcols[]; 477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes /** 497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes * When updatable these are the PK column indices (0-based) of uptable. 507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes */ 517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private int pkcoli[]; 527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes /* 547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes * Constants to reflect updateability. 557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes */ 567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private final static int UPD_UNKNOWN = -1; 577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private final static int UPD_NO = 0; 587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private final static int UPD_INS = 1; 597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private final static int UPD_INSUPDDEL = 2; 607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes /** 627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes * Flag for cursor being (not) on insert row. 637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes */ 647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private boolean oninsrow; 657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes /** 677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes * Row buffer for insert/update row. 687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes */ 697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private String rowbuf[]; 707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes private static final boolean nullrepl = 727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes SQLite.Database.version().compareTo("2.5.0") < 0; 73417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 74417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public JDBCResultSet(SQLite.TableResult tr, JDBCStatement s) { 757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.tr = tr; 767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.s = s; 777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.md = null; 787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.lastg = null; 797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.row = -1; 807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.updatable = UPD_UNKNOWN; 817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.oninsrow = false; 827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.rowbuf = null; 837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public boolean isUpdatable() throws SQLException { 867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (updatable == UPD_UNKNOWN) { 877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes JDBCResultSetMetaData m = 897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes (JDBCResultSetMetaData) getMetaData(); 907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes java.util.HashSet<String> h = new java.util.HashSet<String>(); 917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String lastt = null; 927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (int i = 1; i <= tr.ncolumns; i++) { 937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastt = m.getTableName(i); 947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes h.add(lastt); 957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (h.size() > 1 || lastt == null) { 977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updatable = UPD_NO; 987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("view or join"); 997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updatable = UPD_INS; 1017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes uptable = lastt; 1027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes JDBCResultSet pk = (JDBCResultSet) 1037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes s.conn.getMetaData().getPrimaryKeys(null, null, uptable); 1047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (pk.tr.nrows > 0) { 1057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes boolean colnotfound = false; 1067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes pkcols = new String[pk.tr.nrows]; 1077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes pkcoli = new int[pk.tr.nrows]; 1087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (int i = 0; i < pk.tr.nrows; i++) { 1097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) pk.tr.rows.elementAt(i); 1107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes pkcols[i] = rd[3]; 1117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 1127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes pkcoli[i] = findColumn(pkcols[i]) - 1; 1137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (SQLException ee) { 1147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes colnotfound = true; 1157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (!colnotfound) { 1187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updatable = UPD_INSUPDDEL; 1197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes pk.close(); 1227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (SQLException e) { 1237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updatable = UPD_NO; 1247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (updatable < UPD_INS) { 1277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("result set not updatable"); 1287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return true; 1307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 1327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void fillRowbuf() throws SQLException { 1337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (rowbuf == null) { 1347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (row < 0) { 1357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("cursor outside of result set"); 1367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = new String[tr.ncolumns]; 1387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes System.arraycopy((String []) tr.rows.elementAt(row), 0, 1397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf, 0, tr.ncolumns); 1407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 141417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 142417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 143417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean next() throws SQLException { 1447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 1457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 1467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row++; 1487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return row < tr.nrows; 149417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 150417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 151417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public int findColumn(String columnName) throws SQLException { 1527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes JDBCResultSetMetaData m = (JDBCResultSetMetaData) getMetaData(); 1537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return m.findColByName(columnName); 154417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 155417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 156417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public int getRow() throws SQLException { 1577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 1587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("no rows"); 1597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return row + 1; 161417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 162417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 163417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean previous() throws SQLException { 1647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 1654538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe throw new SQLException("result set already closed."); 1667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (row >= 0) { 1687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row--; 1697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return row >= 0; 171417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 172417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 173417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean absolute(int row) throws SQLException { 1747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 1757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 1767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (row < 0) { 1787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row = tr.nrows + 1 + row; 1797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row--; 1817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (row < 0 || row > tr.nrows) { 1827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 1837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.row = row; 1857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return true; 186417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 187417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 188417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean relative(int row) throws SQLException { 1897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 1907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 1917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (this.row + row < 0 || this.row + row >= tr.nrows) { 1937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 1947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.row += row; 1967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return true; 197417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 198417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 199417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void setFetchDirection(int dir) throws SQLException { 2007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (dir != ResultSet.FETCH_FORWARD) { 20117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLException("only forward fetch direction supported"); 2027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 203417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 204417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 205417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public int getFetchDirection() throws SQLException { 2067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return ResultSet.FETCH_FORWARD; 207417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 208417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 209417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void setFetchSize(int fsize) throws SQLException { 2107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (fsize != 1) { 21117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLException("fetch size must be 1"); 2127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 213417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 214417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 215417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public int getFetchSize() throws SQLException { 2167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return 1; 217417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 218417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 219417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public String getString(int columnIndex) throws SQLException { 2207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 2217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 2227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 2237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 2247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 2257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return lastg; 226417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 227417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 228417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public String getString(String columnName) throws SQLException { 2297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 2307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getString(col); 231417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 232417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 233417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public int getInt(int columnIndex) throws SQLException { 2347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes Integer i = internalGetInt(columnIndex); 2357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (i != null) { 2367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return i.intValue(); 2377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 2387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return 0; 239417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 240417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 241417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private Integer internalGetInt(int columnIndex) throws SQLException { 2427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 2437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 2447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 2457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 2467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 2477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 2487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return Integer.valueOf(lastg); 2497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 2507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 2517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 2527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 253417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 254417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 255417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public int getInt(String columnName) throws SQLException { 2567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 2577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getInt(col); 258417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 259417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 260417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean getBoolean(int columnIndex) throws SQLException { 2617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getInt(columnIndex) == 1 || 2624538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe Boolean.parseBoolean(getString(columnIndex)); 263417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 264417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 265417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean getBoolean(String columnName) throws SQLException { 2667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 2677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getBoolean(col); 268417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 269417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 270417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public ResultSetMetaData getMetaData() throws SQLException { 2717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (md == null) { 2727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes md = new JDBCResultSetMetaData(this); 2737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 2747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return md; 275417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 276417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 277417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public short getShort(int columnIndex) throws SQLException { 2787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes Short sh = internalGetShort(columnIndex); 2797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (sh != null) { 2807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return sh.shortValue(); 2817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 2827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return 0; 283417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 284417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 285417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private Short internalGetShort(int columnIndex) throws SQLException { 2867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 2877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 2887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 2897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 2907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 2917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 2927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return Short.valueOf(lastg); 2937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 2947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 2957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 2967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 297417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 298417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 299417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public short getShort(String columnName) throws SQLException { 3007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 3017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getShort(col); 302417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 303417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 304417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Time getTime(int columnIndex) throws SQLException { 3057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return internalGetTime(columnIndex, null); 306417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 307417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 308417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private java.sql.Time internalGetTime(int columnIndex, 3097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes java.util.Calendar cal) 3107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 3117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 3127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 3137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 3157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 3167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 3177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (s.conn.useJulian) { 3187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 3197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.sql.Time(SQLite.Database.long_from_julian(lastg)); 3207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception ee) { 3217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return java.sql.Time.valueOf(lastg); 3227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } else { 3247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 3257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return java.sql.Time.valueOf(lastg); 3267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception ee) { 3277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.sql.Time(SQLite.Database.long_from_julian(lastg)); 3287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 3317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 3327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 334417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 335417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 336417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Time getTime(String columnName) throws SQLException { 3377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 3387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getTime(col); 339417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 340417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 341417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Time getTime(int columnIndex, java.util.Calendar cal) 3427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 3437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return internalGetTime(columnIndex, cal); 344417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 345417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 346417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Time getTime(String columnName, java.util.Calendar cal) 3477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException{ 3487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 3497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getTime(col, cal); 350417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 351417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 352417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Timestamp getTimestamp(int columnIndex) 3537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException{ 3547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return internalGetTimestamp(columnIndex, null); 355417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 356417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 357417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private java.sql.Timestamp internalGetTimestamp(int columnIndex, 3587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes java.util.Calendar cal) 3597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 3607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 3617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 3627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 3647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 3657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 3667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (s.conn.useJulian) { 3677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 3687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.sql.Timestamp(SQLite.Database.long_from_julian(lastg)); 3697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception ee) { 3707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return java.sql.Timestamp.valueOf(lastg); 3717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } else { 3737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 3747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return java.sql.Timestamp.valueOf(lastg); 3757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception ee) { 3767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.sql.Timestamp(SQLite.Database.long_from_julian(lastg)); 3777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 3807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 3817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 3827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 383417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 384417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 385417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Timestamp getTimestamp(String columnName) 3867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException{ 3877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 3887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getTimestamp(col); 389417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 390417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 391417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Timestamp getTimestamp(int columnIndex, 3927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes java.util.Calendar cal) 3937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 3947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return internalGetTimestamp(columnIndex, cal); 395417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 396417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 397417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Timestamp getTimestamp(String columnName, 3987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes java.util.Calendar cal) 3997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 4007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 4017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getTimestamp(col, cal); 402417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 403417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 404417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Date getDate(int columnIndex) throws SQLException { 4057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return internalGetDate(columnIndex, null); 406417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 407417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 408417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private java.sql.Date internalGetDate(int columnIndex, 4097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes java.util.Calendar cal) 4107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 4117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 4127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 4137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 4157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 4167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 4177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (s.conn.useJulian) { 4187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 4197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.sql.Date(SQLite.Database.long_from_julian(lastg)); 4207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception ee) { 4217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return java.sql.Date.valueOf(lastg); 4227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } else { 4247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 4257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return java.sql.Date.valueOf(lastg); 4267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception ee) { 4277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.sql.Date(SQLite.Database.long_from_julian(lastg)); 4287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 4317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 4327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 434417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 435417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 436417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Date getDate(String columnName) throws SQLException { 4377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 4387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getDate(col); 439417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 440417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 441417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Date getDate(int columnIndex, java.util.Calendar cal) 4427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException{ 4437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return internalGetDate(columnIndex, cal); 444417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 445417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 446417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Date getDate(String columnName, java.util.Calendar cal) 4477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException{ 4487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 4497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getDate(col, cal); 450417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 451417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 452417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public double getDouble(int columnIndex) throws SQLException { 4537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes Double d = internalGetDouble(columnIndex); 4547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (d != null) { 4557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return d.doubleValue(); 4567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return 0; 458417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 459417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 460417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private Double internalGetDouble(int columnIndex) throws SQLException { 4617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 4627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 4637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 4657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 4667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 4677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return Double.valueOf(lastg); 4687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 4697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 4707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 472417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 473417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 474417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public double getDouble(String columnName) throws SQLException { 4757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 4767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getDouble(col); 477417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 478417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 479417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public float getFloat(int columnIndex) throws SQLException { 4807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes Float f = internalGetFloat(columnIndex); 4817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (f != null) { 4827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return f.floatValue(); 4837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return 0; 485417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 486417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 487417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private Float internalGetFloat(int columnIndex) throws SQLException { 4887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 4897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 4907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 4927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 4937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 4947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return Float.valueOf(lastg); 4957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 4967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 4977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 4987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 499417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 500417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 501417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public float getFloat(String columnName) throws SQLException { 5027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 5037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getFloat(col); 504417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 505417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 506417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public long getLong(int columnIndex) throws SQLException { 5077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes Long l = internalGetLong(columnIndex); 5087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (l != null) { 5097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return l.longValue(); 5107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 5117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return 0; 512417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 513417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 514417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes private Long internalGetLong(int columnIndex) throws SQLException { 5157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 5167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 5177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 5187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 5197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 5207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 5217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return Long.valueOf(lastg); 5227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 5237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 5247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 5257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 526417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 527417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 528417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public long getLong(String columnName) throws SQLException { 5297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 5307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getLong(col); 531417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 532417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 533417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes @Deprecated 534417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.io.InputStream getUnicodeStream(int columnIndex) 5357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 53617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 537417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 538417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 539417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes @Deprecated 540417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.io.InputStream getUnicodeStream(String columnName) 5417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 54217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 54317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getUnicodeStream(col); 544417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 545417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 546417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.io.InputStream getAsciiStream(String columnName) 5477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 54817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 54917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getAsciiStream(col); 550417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 551417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 552417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.io.InputStream getAsciiStream(int columnIndex) 5537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 5547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("not supported"); 555417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 556417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 557417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public BigDecimal getBigDecimal(String columnName) 5587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 55917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 56017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getBigDecimal(col); 561417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 562417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 563417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes @Deprecated 564417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public BigDecimal getBigDecimal(String columnName, int scale) 5657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 56617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 56717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getBigDecimal(col, scale); 568417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 569417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 570417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public BigDecimal getBigDecimal(int columnIndex) throws SQLException { 57117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 572417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 573417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 574417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes @Deprecated 575417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public BigDecimal getBigDecimal(int columnIndex, int scale) 5767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 57717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 578417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 579417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 580417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.io.InputStream getBinaryStream(int columnIndex) 5817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 5827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes byte data[] = getBytes(columnIndex); 5837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (data != null) { 5847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.io.ByteArrayInputStream(data); 5857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 5867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 587417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 588417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 589417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.io.InputStream getBinaryStream(String columnName) 5907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 5917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes byte data[] = getBytes(columnName); 5927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (data != null) { 5937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.io.ByteArrayInputStream(data); 5947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 5957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 596417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 597417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 598417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public byte getByte(int columnIndex) throws SQLException { 5997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("not supported"); 600417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 601417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 602417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public byte getByte(String columnName) throws SQLException { 60317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 60417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getByte(col); 605417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 606417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 607417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public byte[] getBytes(int columnIndex) throws SQLException { 6087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 6097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 6107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 6117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes byte ret[] = null; 6127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 6137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 6147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (lastg != null) { 6157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes ret = SQLite.StringEncoder.decode(lastg); 6167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 6177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return ret; 618417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 619417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 620417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public byte[] getBytes(String columnName) throws SQLException { 6217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 6227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getBytes(col); 623417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 624417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 625417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public String getCursorName() throws SQLException { 6267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 627417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 628417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 629417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public Object getObject(int columnIndex) throws SQLException { 6307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || columnIndex < 1 || columnIndex > tr.ncolumns) { 6317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + columnIndex + " not found"); 6327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 6337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 6347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[columnIndex - 1]; 6357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes Object ret = lastg; 6367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr instanceof TableResultX) { 6377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes switch (((TableResultX) tr).sql_type[columnIndex - 1]) { 6387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.SMALLINT: 6397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes ret = internalGetShort(columnIndex); 6407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes break; 6417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.INTEGER: 6427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes ret = internalGetInt(columnIndex); 6437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes break; 6447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.DOUBLE: 6457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes ret = internalGetDouble(columnIndex); 6467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes break; 6477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.FLOAT: 6487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes ret = internalGetFloat(columnIndex); 6497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes break; 6507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.BIGINT: 6517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes ret = internalGetLong(columnIndex); 6527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes break; 6537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.BINARY: 6547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.VARBINARY: 6557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.LONGVARBINARY: 6567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes ret = getBytes(columnIndex); 6577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes break; 6587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes case Types.NULL: 6597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes ret = null; 6607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes break; 6617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes /* defaults to String below */ 6627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 6637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 6647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return ret; 665417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 666417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 667417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public Object getObject(String columnName) throws SQLException { 6687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(columnName); 6697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getObject(col); 670417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 671417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 672417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public Object getObject(int columnIndex, java.util.Map map) 6737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 67417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 675417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 676417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 67717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public Object getObject(String columnName, java.util.Map map) 6787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 67917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 68017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getObject(col, map); 681417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 682417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 683417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Ref getRef(int columnIndex) throws SQLException { 68417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 685417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 686417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 68717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public java.sql.Ref getRef(String columnName) throws SQLException { 68817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 68917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getRef(col); 690417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 691417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 692417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Blob getBlob(int columnIndex) throws SQLException { 69317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 694417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 695417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 69617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public java.sql.Blob getBlob(String columnName) throws SQLException { 69717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 69817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getBlob(col); 699417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 700417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 701417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Clob getClob(int columnIndex) throws SQLException { 70217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 703417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 704417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 70517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public java.sql.Clob getClob(String columnName) throws SQLException { 70617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 70717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getClob(col); 708417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 709417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 710417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.sql.Array getArray(int columnIndex) throws SQLException { 71117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 712417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 713417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 71417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public java.sql.Array getArray(String columnName) throws SQLException { 71517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(columnName); 71617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getArray(col); 717417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 718417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 719417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.io.Reader getCharacterStream(int columnIndex) 7207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 7217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String data = getString(columnIndex); 7227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (data != null) { 7237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes char[] cdata = data.toCharArray(); 7247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.io.CharArrayReader(cdata); 7257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 727417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 728417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 729417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.io.Reader getCharacterStream(String columnName) 7307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 7317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String data = getString(columnName); 7327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (data != null) { 7337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes char[] cdata = data.toCharArray(); 7347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return new java.io.CharArrayReader(cdata); 7357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return null; 737417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 738417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 739417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public SQLWarning getWarnings() throws SQLException { 7407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("not supported"); 741417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 742417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 743417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean wasNull() throws SQLException { 7447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return lastg == null; 745417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 7467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 747417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void clearWarnings() throws SQLException { 7487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("not supported"); 749417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 750417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 751417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean isFirst() throws SQLException { 7527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 7537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return true; 7547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return row == 0; 756417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 757417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 758417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean isBeforeFirst() throws SQLException { 7597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || tr.nrows <= 0) { 7607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 7617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return row < 0; 763417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 764417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 765417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void beforeFirst() throws SQLException { 7667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 7677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return; 7687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row = -1; 770417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 771417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 772417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean first() throws SQLException { 7737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || tr.nrows <= 0) { 7747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 7757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row = 0; 7777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return true; 778417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 779417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 780417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean isAfterLast() throws SQLException { 7817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || tr.nrows <= 0) { 7827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 7837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return row >= tr.nrows; 785417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 786417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 787417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void afterLast() throws SQLException { 7887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 7897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return; 7907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row = tr.nrows; 792417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 793417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 794417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean isLast() throws SQLException { 7957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null) { 7967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return true; 7977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 7987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return row == tr.nrows - 1; 799417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 800417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 801417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean last() throws SQLException { 8027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || tr.nrows <= 0) { 8037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 8047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row = tr.nrows -1; 8067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return true; 807417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 808417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 809417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public int getType() throws SQLException { 8107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return TYPE_SCROLL_SENSITIVE; 811417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 812417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 813417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public int getConcurrency() throws SQLException { 8147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return CONCUR_UPDATABLE; 815417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 816417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 817417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean rowUpdated() throws SQLException { 8187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 819417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 820417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 821417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean rowInserted() throws SQLException { 8227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 823417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 824417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 825417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public boolean rowDeleted() throws SQLException { 8267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return false; 827417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 828417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 829417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void insertRow() throws SQLException { 8307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 8317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (!oninsrow || rowbuf == null) { 8327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("no insert data provided"); 8337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes JDBCResultSetMetaData m = (JDBCResultSetMetaData) getMetaData(); 8357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes StringBuffer sb = new StringBuffer(); 8367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append("INSERT INTO "); 8377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(uptable)); 8387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append("("); 8397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (int i = 0; i < tr.ncolumns; i++) { 8407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(m.getColumnName(i + 1))); 8417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (i < tr.ncolumns - 1) { 8427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(","); 8437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(") VALUES("); 8467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (int i = 0; i < tr.ncolumns; i++) { 8477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(nullrepl ? "'%q'" : "%Q"); 8487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (i < tr.ncolumns - 1) { 8497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(","); 8507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(")"); 8537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 8547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.s.conn.db.exec(sb.toString(), null, rowbuf); 8557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (SQLite.Exception e) { 8567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException(e.getMessage()); 8577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes tr.newrow(rowbuf); 8597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = null; 8607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes oninsrow = false; 8617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes last(); 862417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 863417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 864417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateRow() throws SQLException { 8657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 8667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (rowbuf == null) { 8677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("no update data provided"); 8687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (oninsrow) { 8707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("cursor on insert row"); 8717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (updatable < UPD_INSUPDDEL) { 8737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("no primary key on table defined"); 8747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 8767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes JDBCResultSetMetaData m = (JDBCResultSetMetaData) getMetaData(); 8777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String args[] = new String[tr.ncolumns + pkcols.length]; 8787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes StringBuffer sb = new StringBuffer(); 8797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append("UPDATE "); 8807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(uptable)); 8817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" SET "); 8827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int i; 8837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (i = 0; i < tr.ncolumns; i++) { 8847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(m.getColumnName(i + 1))); 8857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" = " + (nullrepl ? "'%q'" : "%Q")); 8867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (i < tr.ncolumns - 1) { 8877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(","); 8887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes args[i] = rowbuf[i]; 8907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb. append(" WHERE "); 8927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (int k = 0; k < pkcols.length; k++, i++) { 8937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(pkcols[k])); 8947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" = " + (nullrepl ? "'%q'" : "%Q")); 8957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (k < pkcols.length - 1) { 8967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" AND "); 8977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 8987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes args[i] = rd[pkcoli[k]]; 8997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 9017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.s.conn.db.exec(sb.toString(), null, args); 9027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (SQLite.Exception e) { 9037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException(e.getMessage()); 9047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes System.arraycopy(rowbuf, 0, rd, 0, rowbuf.length); 9067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = null; 907417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 908417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 909417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void deleteRow() throws SQLException { 9107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 9117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (oninsrow) { 9127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("cursor on insert row"); 9137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (updatable < UPD_INSUPDDEL) { 9157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("no primary key on table defined"); 9167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 9187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes StringBuffer sb = new StringBuffer(); 9197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append("DELETE FROM "); 9207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(uptable)); 9217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" WHERE "); 9227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String args[] = new String[pkcols.length]; 9237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (int i = 0; i < pkcols.length; i++) { 9247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(pkcols[i])); 9257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" = " + (nullrepl ? "'%q'" : "%Q")); 9267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (i < pkcols.length - 1) { 9277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" AND "); 9287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes args[i] = rowbuf[pkcoli[i]]; 9307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 9327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes this.s.conn.db.exec(sb.toString(), null, args); 9337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (SQLite.Exception e) { 9347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException(e.getMessage()); 9357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = null; 937417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 938417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 939417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void refreshRow() throws SQLException { 9407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 9417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (oninsrow) { 9427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("cursor on insert row"); 9437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (updatable < UPD_INSUPDDEL) { 9457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("no primary key on table defined"); 9467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes JDBCResultSetMetaData m = (JDBCResultSetMetaData) getMetaData(); 9487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 9497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes StringBuffer sb = new StringBuffer(); 9507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append("SELECT "); 9517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (int i = 0; i < tr.ncolumns; i++) { 9527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(m.getColumnName(i + 1))); 9537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (i < tr.ncolumns - 1) { 9547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(","); 9557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" FROM "); 9587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(uptable)); 9597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" WHERE "); 9607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String args[] = new String[pkcols.length]; 9617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes for (int i = 0; i < pkcols.length; i++) { 9627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(SQLite.Shell.sql_quote_dbl(pkcols[i])); 9637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" = " + (nullrepl ? "'%q'" : "%Q")); 9647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (i < pkcols.length - 1) { 9657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes sb.append(" AND "); 9667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes args[i] = rd[pkcoli[i]]; 9687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes SQLite.TableResult trnew = null; 9707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 9717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes trnew = this.s.conn.db.get_table(sb.toString(), args); 9727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (SQLite.Exception e) { 9737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException(e.getMessage()); 9747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (trnew.nrows != 1) { 9767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("wrong size of result set"); 9777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 9787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = null; 9797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes tr.rows.setElementAt(trnew.rows.elementAt(0), row); 980417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 981417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 982417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void cancelRowUpdates() throws SQLException { 9837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = null; 984417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 985417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 986417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void moveToInsertRow() throws SQLException { 9877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 9887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (!oninsrow) { 9897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes oninsrow = true; 9907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = new String[tr.nrows]; 9917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 992417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 993417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 994417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void moveToCurrentRow() throws SQLException { 9957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (oninsrow) { 9967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes oninsrow = false; 9977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = null; 9987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 999417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1000417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1001417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateNull(int colIndex) throws SQLException { 10027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = null; 1008417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1009417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1010417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateBoolean(int colIndex, boolean b) throws SQLException { 10117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateString(colIndex, b ? "1" : "0"); 1012417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1013417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1014417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateByte(int colIndex, byte b) throws SQLException { 101517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1016417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1017417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1018417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateShort(int colIndex, short b) throws SQLException { 10197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = Short.toString(b); 1025417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1026417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1027417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateInt(int colIndex, int b) throws SQLException { 10287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = Integer.toString(b); 1034417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1035417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1036417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateLong(int colIndex, long b) throws SQLException { 10377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = Long.toString(b); 1043417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1044417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1045417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateFloat(int colIndex, float f) throws SQLException { 10467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = Float.toString(f); 1052417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1053417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1054417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateDouble(int colIndex, double f) throws SQLException { 10557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = Double.toString(f); 1061417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1062417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1063417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateBigDecimal(int colIndex, BigDecimal f) 10647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 106517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1066417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1067417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1068417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateString(int colIndex, String s) throws SQLException { 10697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = s; 1075417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1076417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1077417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateBytes(int colIndex, byte[] s) throws SQLException { 10787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (this.s.conn.db.is3()) { 10847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = SQLite.StringEncoder.encodeX(s); 10857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } else { 10867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = SQLite.StringEncoder.encode(s); 10877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 1088417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1089417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1090417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateDate(int colIndex, java.sql.Date d) throws SQLException { 10917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 10927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 10937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 10947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 10957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 10967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = d.toString(); 1097417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1098417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1099417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateTime(int colIndex, java.sql.Time t) throws SQLException { 11007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 11017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 11027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 11037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 11047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 11057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = t.toString(); 1106417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1107417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1108417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateTimestamp(int colIndex, java.sql.Timestamp t) 11097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 11107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes isUpdatable(); 11117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 11127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 11137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 11147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes fillRowbuf(); 11157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf[colIndex - 1] = t.toString(); 1116417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1117417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1118417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateAsciiStream(int colIndex, java.io.InputStream in, int s) 11197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 112017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1121417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1122417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1123417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateBinaryStream(int colIndex, java.io.InputStream in, int s) 11247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 112517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1126417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1127417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1128417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateCharacterStream(int colIndex, java.io.Reader in, int s) 11297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 113017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1131417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1132417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1133417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateObject(int colIndex, Object obj) throws SQLException { 11347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateString(colIndex, obj.toString()); 1135417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1136417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1137417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateObject(int colIndex, Object obj, int s) 11387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 11397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateString(colIndex, obj.toString()); 1140417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1141417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateNull(String colName) throws SQLException { 11437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateNull(col); 1145417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1146417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateBoolean(String colName, boolean b) throws SQLException { 11487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateBoolean(col, b); 1150417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1151417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateByte(String colName, byte b) throws SQLException { 115317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 115417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateByte(col, b); 1155417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1156417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateShort(String colName, short b) throws SQLException { 11587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateShort(col, b); 1160417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1161417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateInt(String colName, int b) throws SQLException { 11637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateInt(col, b); 1165417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1166417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateLong(String colName, long b) throws SQLException { 11687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateLong(col, b); 1170417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1171417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateFloat(String colName, float f) throws SQLException { 11737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateFloat(col, f); 1175417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1176417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateDouble(String colName, double f) throws SQLException { 11787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateDouble(col, f); 1180417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1181417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateBigDecimal(String colName, BigDecimal f) 11837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 118417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 118517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateBigDecimal(col, f); 1186417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1187417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateString(String colName, String s) throws SQLException { 11897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateString(col, s); 1191417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1192417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateBytes(String colName, byte[] s) throws SQLException { 11947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 11957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateBytes(col, s); 1196417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1197417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 11987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateDate(String colName, java.sql.Date d) 11997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 12007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 12017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateDate(col, d); 1202417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1203417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 12047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateTime(String colName, java.sql.Time t) 12057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 12067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 12077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateTime(col, t); 1208417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1209417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 12107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateTimestamp(String colName, java.sql.Timestamp t) 12117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 12127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 12137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateTimestamp(col, t); 1214417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1215417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 12167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateAsciiStream(String colName, java.io.InputStream in, 12177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int s) 12187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 121917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 122017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateAsciiStream(col, in, s); 1221417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1222417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 12237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateBinaryStream(String colName, java.io.InputStream in, 12247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int s) 12257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 122617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 122717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateBinaryStream(col, in, s); 1228417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1229417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 12307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateCharacterStream(String colName, java.io.Reader in, 12317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int s) 12327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 123317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 123417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateCharacterStream(col, in, s); 1235417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1236417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 12377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateObject(String colName, Object obj) 12387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 12397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 12407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateObject(col, obj); 1241417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1242417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 12437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateObject(String colName, Object obj, int s) 12447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 12457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 12467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes updateObject(col, obj, s); 1247417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1248417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1249417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public Statement getStatement() throws SQLException { 12507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (s == null) { 12517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("stale result set"); 12527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 12537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return s; 1254417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1255417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1256417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void close() throws SQLException { 12577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes s = null; 12587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes tr = null; 12597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = null; 12607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes oninsrow = false; 12617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes rowbuf = null; 12627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes row = -1; 1263417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1264417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1265417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public java.net.URL getURL(int colIndex) throws SQLException { 12667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (tr == null || colIndex < 1 || colIndex > tr.ncolumns) { 12677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throw new SQLException("column " + colIndex + " not found"); 12687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 12697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes String rd[] = (String []) tr.rows.elementAt(row); 12707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes lastg = rd[colIndex - 1]; 12717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes java.net.URL url = null; 12727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes if (lastg == null) { 12737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return url; 12747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 12757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes try { 12767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes url = new java.net.URL(lastg); 12777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } catch (java.lang.Exception e) { 12787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes url = null; 12797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 12807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return url; 12817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes } 12827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes 12837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public java.net.URL getURL(String colName) throws SQLException { 12847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes int col = findColumn(colName); 12857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes return getURL(col); 1286417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1287417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1288417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateRef(int colIndex, java.sql.Ref x) throws SQLException { 128917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1290417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1291417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 12927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateRef(String colName, java.sql.Ref x) 12937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 129417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 129517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateRef(col, x); 1296417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1297417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1298417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateBlob(int colIndex, java.sql.Blob x) 12997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 130017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1301417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1302417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 13037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateBlob(String colName, java.sql.Blob x) 13047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 130517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 130617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateBlob(col, x); 1307417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1308417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1309417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateClob(int colIndex, java.sql.Clob x) 13107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 131117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1312417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1313417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 13147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateClob(String colName, java.sql.Clob x) 13157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 131617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 131717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateClob(col, x); 1318417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1319417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1320417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes public void updateArray(int colIndex, java.sql.Array x) 13217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 132217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 1323417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1324417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 13257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes public void updateArray(String colName, java.sql.Array x) 13267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes throws SQLException { 132717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 132817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateArray(col, x); 132917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 133017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 133117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public RowId getRowId(int colIndex) throws SQLException { 133217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 133317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 133417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 133517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public RowId getRowId(String colName) throws SQLException { 133617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 133717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getRowId(col); 133817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 133917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 134017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateRowId(int colIndex, RowId x) throws SQLException { 134117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 134217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 134317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 134417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateRowId(String colName, RowId x) throws SQLException { 134517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 134617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateRowId(col, x); 134717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 134817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 134917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public int getHoldability() throws SQLException { 135017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return ResultSet.CLOSE_CURSORS_AT_COMMIT; 135117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 135217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 135317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public boolean isClosed() throws SQLException { 135417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return tr == null; 135517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 135617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 135717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNString(int colIndex, String nString) 135817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 135917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 136017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 136117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 136217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNString(String colName, String nString) 136317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 136417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 136517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateNString(col, nString); 136617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 136717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 136817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNClob(int colIndex, NClob nclob) 136917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 137017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 137117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 137217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 137317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNClob(String colName, NClob nclob) 137417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 137517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 137617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateNClob(col, nclob); 137717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 137817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 137917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public NClob getNClob(int colIndex) throws SQLException { 138017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 138117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 138217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 138317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public NClob getNClob(String colName) throws SQLException { 138417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 138517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getNClob(col); 138617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 138717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 138817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public SQLXML getSQLXML(int colIndex) throws SQLException { 138917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 139017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 139117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 139217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public SQLXML getSQLXML(String colName) throws SQLException { 139317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 139417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getSQLXML(col); 139517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 139617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 139717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateSQLXML(int colIndex, SQLXML xml) 139817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 139917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 140017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 140117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 140217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateSQLXML(String colName, SQLXML xml) 140317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 140417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 140517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateSQLXML(col, xml); 140617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 140717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 140817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public String getNString(int colIndex) throws SQLException { 140917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 141017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 141117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 141217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public String getNString(String colName) throws SQLException { 141317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 141417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getNString(col); 141517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 141617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 141717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public java.io.Reader getNCharacterStream(int colIndex) 141817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 141917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 142017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 142117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 142217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public java.io.Reader getNCharacterStream(String colName) 142317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 142417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 142517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return getNCharacterStream(col); 142617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 142717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 142817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNCharacterStream(int colIndex, java.io.Reader x, 142917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 143017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 143117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 143217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 143317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 143417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNCharacterStream(String colName, java.io.Reader x, 143517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 143617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 143717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 143817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateNCharacterStream(col, x, len); 143917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 144017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 144117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateAsciiStream(int colIndex, java.io.InputStream x, 144217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 144317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 144417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 144517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 144617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 144717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateAsciiStream(String colName, java.io.InputStream x, 144817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 144917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 145017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 145117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateAsciiStream(col, x, len); 145217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 145317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 145417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateBinaryStream(int colIndex, java.io.InputStream x, 145517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 145617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 145717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 145817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 145917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 146017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateBinaryStream(String colName, java.io.InputStream x, 146117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 146217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 146317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 146417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateBinaryStream(col, x, len); 146517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 146617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 146717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateCharacterStream(int colIndex, java.io.Reader x, 146817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 146917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 147017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 147117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 147217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 147317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateCharacterStream(String colName, java.io.Reader x, 147417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 147517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 147617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 147717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateCharacterStream(col, x, len); 147817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 147917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 148017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateBlob(int colIndex, java.io.InputStream x, 148117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 148217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 148317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 148417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 148517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 148617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateBlob(String colName, java.io.InputStream x, 148717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 148817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 148917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 149017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateBlob(col, x, len); 149117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 149217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 149317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateClob(int colIndex, java.io.Reader x, 149417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 149517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 149617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 149717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 149817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 149917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateClob(String colName, java.io.Reader x, 150017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 150117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 150217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 150317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateClob(col, x, len); 150417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 150517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 150617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNClob(int colIndex, java.io.Reader x, 150717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 150817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 150917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 151017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 151117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 151217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNClob(String colName, java.io.Reader x, 151317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe long len) 151417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 151517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 151617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateNClob(col, x, len); 151717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 151817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 151917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNCharacterStream(int colIndex, java.io.Reader x) 152017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 152117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 152217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 152317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 152417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNCharacterStream(String colName, java.io.Reader x) 152517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 152617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 152717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateNCharacterStream(col, x); 152817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 152917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 153017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateAsciiStream(int colIndex, java.io.InputStream x) 153117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 153217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 153317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 153417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 153517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateAsciiStream(String colName, java.io.InputStream x) 153617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 153717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 153817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateAsciiStream(col, x); 153917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 154017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 154117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateBinaryStream(int colIndex, java.io.InputStream x) 154217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 154317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 154417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 154517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 154617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateBinaryStream(String colName, java.io.InputStream x) 154717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 154817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 154917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateBinaryStream(col, x); 155017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 155117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 155217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateCharacterStream(int colIndex, java.io.Reader x) 155317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 155417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 155517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 155617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 155717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateCharacterStream(String colName, java.io.Reader x) 155817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 155917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 156017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateCharacterStream(col, x); 156117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 156217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 156317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateBlob(int colIndex, java.io.InputStream x) 156417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 156517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 156617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 156717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 156817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateBlob(String colName, java.io.InputStream x) 156917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 157017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 157117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateBlob(col, x); 157217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 157317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 157417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateClob(int colIndex, java.io.Reader x) 157517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 157617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 157717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 157817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 157917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateClob(String colName, java.io.Reader x) 158017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 158117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 158217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateClob(col, x); 158317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 158417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 158517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNClob(int colIndex, java.io.Reader x) 158617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 158717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLFeatureNotSupportedException(); 158817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 158917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 159017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public void updateNClob(String colName, java.io.Reader x) 159117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throws SQLException { 159217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe int col = findColumn(colName); 159317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe updateNClob(col, x); 159417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 159517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 159617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public <T> T unwrap(java.lang.Class<T> iface) throws SQLException { 159717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe throw new SQLException("unsupported"); 159817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe } 159917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe 160017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe public boolean isWrapperFor(java.lang.Class iface) throws SQLException { 160117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe return false; 1602417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes } 1603417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes 1604417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes} 1605