diff options
author | Jeremy Sharpe <jsharpe@google.com> | 2010-05-13 16:57:23 -0700 |
---|---|---|
committer | Jeremy Sharpe <jsharpe@google.com> | 2010-05-25 18:13:23 -0700 |
commit | 36b3cdfbcd219d0308753d919638262c16fd34da (patch) | |
tree | f3dbbb39897037baa52604ada58f7d3e4eaf89a4 /sqlite-jdbc/src | |
parent | a9a0e081cd598bcdfc0254233766d8c82552da11 (diff) | |
download | libcore-36b3cdfbcd219d0308753d919638262c16fd34da.zip libcore-36b3cdfbcd219d0308753d919638262c16fd34da.tar.gz libcore-36b3cdfbcd219d0308753d919638262c16fd34da.tar.bz2 |
Implement Java 6 SQL API. Javadoc is still messy and some unit tests
need to be updated to reflect newly implemented parts of the API.
Change-Id: Icee718ef997d29aa08fc78b101f87532dc89167f
Diffstat (limited to 'sqlite-jdbc/src')
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/Database.java | 1 | ||||
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCConnection.java (renamed from sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCConnection.java) | 93 | ||||
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCDatabaseMetaData.java (renamed from sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCDatabaseMetaData.java) | 54 | ||||
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCPreparedStatement.java (renamed from sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCPreparedStatement.java) | 198 | ||||
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCResultSet.java (renamed from sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCResultSet.java) | 380 | ||||
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCResultSetMetaData.java (renamed from sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCResultSetMetaData.java) | 11 | ||||
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCStatement.java (renamed from sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCStatement.java) | 58 | ||||
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/JDBC2z/TableResultX.java (renamed from sqlite-jdbc/src/main/java/SQLite/JDBC2y/TableResultX.java) | 2 | ||||
-rw-r--r-- | sqlite-jdbc/src/main/java/SQLite/Stmt.java | 2 |
9 files changed, 704 insertions, 95 deletions
diff --git a/sqlite-jdbc/src/main/java/SQLite/Database.java b/sqlite-jdbc/src/main/java/SQLite/Database.java index 200a9bf..f15df94 100644 --- a/sqlite-jdbc/src/main/java/SQLite/Database.java +++ b/sqlite-jdbc/src/main/java/SQLite/Database.java @@ -902,3 +902,4 @@ public class Database { } } } + diff --git a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCConnection.java b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCConnection.java index 67e95da..59c1d3e 100644 --- a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCConnection.java +++ b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCConnection.java @@ -1,4 +1,4 @@ -package SQLite.JDBC2y; +package SQLite.JDBC2z; import java.sql.*; import java.util.*; @@ -193,11 +193,11 @@ public class JDBCConnection if (resultSetType != ResultSet.TYPE_FORWARD_ONLY && resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetType != ResultSet.TYPE_SCROLL_SENSITIVE) { - throw new SQLException("unsupported result set type"); + throw new SQLFeatureNotSupportedException("unsupported result set type"); } if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY && resultSetConcurrency != ResultSet.CONCUR_UPDATABLE) { - throw new SQLException("unsupported result set concurrency"); + throw new SQLFeatureNotSupportedException("unsupported result set concurrency"); } JDBCStatement s = new JDBCStatement(this); return s; @@ -279,7 +279,7 @@ public class JDBCConnection public CallableStatement prepareCall(String sql, int x, int y) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public PreparedStatement prepareStatement(String sql) throws SQLException { @@ -293,11 +293,11 @@ public class JDBCConnection if (resultSetType != ResultSet.TYPE_FORWARD_ONLY && resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetType != ResultSet.TYPE_SCROLL_SENSITIVE) { - throw new SQLException("unsupported result set type"); + throw new SQLFeatureNotSupportedException("unsupported result set type"); } if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY && resultSetConcurrency != ResultSet.CONCUR_UPDATABLE) { - throw new SQLException("unsupported result set concurrency"); + throw new SQLFeatureNotSupportedException("unsupported result set concurrency"); } JDBCPreparedStatement s = new JDBCPreparedStatement(this, sql); return s; @@ -384,11 +384,11 @@ public class JDBCConnection } public java.util.Map<String, Class<?>> getTypeMap() throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void setTypeMap(java.util.Map map) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public int getHoldability() throws SQLException { @@ -399,23 +399,23 @@ public class JDBCConnection if (holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT) { return; } - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException("unsupported holdability"); } public Savepoint setSavepoint() throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public Savepoint setSavepoint(String name) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void rollback(Savepoint x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void releaseSavepoint(Savepoint x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public Statement createStatement(int resultSetType, @@ -423,7 +423,7 @@ public class JDBCConnection int resultSetHoldability) throws SQLException { if (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT) { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException("unsupported holdability"); } return createStatement(resultSetType, resultSetConcurrency); } @@ -433,32 +433,87 @@ public class JDBCConnection int resultSetHoldability) throws SQLException { if (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT) { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException("unsupported holdability"); } return prepareStatement(sql, resultSetType, resultSetConcurrency); } public CallableStatement prepareCall(String sql, int x, int y, int z) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public PreparedStatement prepareStatement(String sql, int autokeys) throws SQLException { if (autokeys != Statement.NO_GENERATED_KEYS) { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException("generated keys not supported"); } return prepareStatement(sql); } public PreparedStatement prepareStatement(String sql, int colIndexes[]) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public PreparedStatement prepareStatement(String sql, String columns[]) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); + } + + public Clob createClob() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public Blob createBlob() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public NClob createNClob() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public SQLXML createSQLXML() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public boolean isValid(int timeout) throws SQLException { + return true; + } + + public void setClientInfo(String name, String value) + throws SQLClientInfoException { + throw new SQLClientInfoException(); + } + + public void setClientInfo(Properties prop) throws SQLClientInfoException { + throw new SQLClientInfoException(); + } + + public String getClientInfo(String name) throws SQLException { + throw new SQLException("unsupported"); + } + + public Properties getClientInfo() throws SQLException { + return new Properties(); + } + + public Array createArrayOf(String type, Object[] elems) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public Struct createStruct(String type, Object[] attrs) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public <T> T unwrap(java.lang.Class<T> iface) throws SQLException { + throw new SQLException("unsupported"); + } + + public boolean isWrapperFor(java.lang.Class iface) throws SQLException { + return false; } } diff --git a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCDatabaseMetaData.java b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCDatabaseMetaData.java index 8d76173..847d474 100644 --- a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCDatabaseMetaData.java +++ b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCDatabaseMetaData.java @@ -1,4 +1,4 @@ -package SQLite.JDBC2y; +package SQLite.JDBC2z; import java.sql.*; import java.util.Hashtable; @@ -588,11 +588,11 @@ public class JDBCDatabaseMetaData implements DatabaseMetaData { String tableNamePattern, String columnNamePattern) throws SQLException { - // BEGIN android-changed: add missing error check. - if (conn.db == null) { - throw new SQLException("connection closed"); - } - // END android-changed + // BEGIN android-changed: add missing error check. + if (conn.db == null) { + throw new SQLException("connection closed"); + } + // END android-changed JDBCStatement s = new JDBCStatement(conn); JDBCResultSet rs0 = null; try { @@ -1645,4 +1645,46 @@ public class JDBCDatabaseMetaData implements DatabaseMetaData { return sqlStateXOpen; } + public RowIdLifetime getRowIdLifetime() throws SQLException { + return RowIdLifetime.ROWID_UNSUPPORTED; + } + + public ResultSet getSchemas(String cat, String schema) + throws SQLException { + throw new SQLException("not supported"); + } + + public boolean supportsStoredFunctionsUsingCallSyntax() + throws SQLException { + return false; + } + + public boolean autoCommitFailureClosesAllResultSets() + throws SQLException { + return false; + } + + public ResultSet getClientInfoProperties() throws SQLException { + throw new SQLException("unsupported"); + } + + public ResultSet getFunctions(String cat, String schema, String func) + throws SQLException { + throw new SQLException("unsupported"); + } + + public ResultSet getFunctionColumns(String cat, String schema, + String func, String colpat) + throws SQLException { + throw new SQLException("unsupported"); + } + + public <T> T unwrap(java.lang.Class<T> iface) throws SQLException { + throw new SQLException("unsupported"); + } + + public boolean isWrapperFor(java.lang.Class iface) throws SQLException { + return false; + } + } diff --git a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCPreparedStatement.java b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCPreparedStatement.java index 3d5b045..a5afca0 100644 --- a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCPreparedStatement.java +++ b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCPreparedStatement.java @@ -1,4 +1,4 @@ -package SQLite.JDBC2y; +package SQLite.JDBC2z; import java.sql.*; import java.math.BigDecimal; @@ -286,7 +286,7 @@ public class JDBCPreparedStatement extends JDBCStatement @Deprecated public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void setBinaryStream(int parameterIndex, java.io.InputStream x, @@ -445,19 +445,19 @@ public class JDBCPreparedStatement extends JDBCStatement } public void setRef(int i, Ref x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void setBlob(int i, Blob x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void setClob(int i, Clob x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void setArray(int i, Array x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public ResultSetMetaData getMetaData() throws SQLException { @@ -778,4 +778,190 @@ public class JDBCPreparedStatement extends JDBCStatement throw new SQLException("not supported"); } + public void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNString(int parameterIndex, String value) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNString(String parameterName, String value) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNCharacterStream(int parameterIndex, java.io.Reader x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNCharacterStream(String parameterName, java.io.Reader x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNClob(int parameterIndex, NClob value) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNClob(String parameterName, NClob value) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setClob(int parameterIndex, java.io.Reader x, long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setClob(String parameterName, java.io.Reader x, long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setBlob(int parameterIndex, java.io.InputStream x, long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setBlob(String parameterName, java.io.InputStream x, long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNClob(int parameterIndex, java.io.Reader x, long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNClob(String parameterName, java.io.Reader x, long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setSQLXML(int parameterIndex, SQLXML xml) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setSQLXML(String parameterName, SQLXML xml) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setAsciiStream(int parameterIndex, java.io.InputStream x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setAsciiStream(String parameterName, java.io.InputStream x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setBinaryStream(int parameterIndex, java.io.InputStream x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setBinaryStream(String parameterName, java.io.InputStream x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setCharacterStream(int parameterIndex, java.io.Reader x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setCharacterStream(String parameterName, java.io.Reader x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setAsciiStream(int parameterIndex, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setAsciiStream(String parameterName, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setBinaryStream(int parameterIndex, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setBinaryStream(String parameterName, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setCharacterStream(int parameterIndex, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setCharacterStream(String parameterName, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNCharacterStream(int parameterIndex, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNCharacterStream(String parameterName, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setClob(int parameterIndex, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setClob(String parameterName, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setBlob(int parameterIndex, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setBlob(String parameterName, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNClob(int parameterIndex, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void setNClob(String parameterName, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + } diff --git a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCResultSet.java b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCResultSet.java index 24e110f..574366e 100644 --- a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCResultSet.java +++ b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCResultSet.java @@ -1,4 +1,4 @@ -package SQLite.JDBC2y; +package SQLite.JDBC2z; import java.sql.*; import java.math.BigDecimal; @@ -200,7 +200,7 @@ public class JDBCResultSet implements java.sql.ResultSet { public void setFetchDirection(int dir) throws SQLException { if (dir != ResultSet.FETCH_FORWARD) { - throw new SQLException("not supported"); + throw new SQLException("only forward fetch direction supported"); } } @@ -210,7 +210,7 @@ public class JDBCResultSet implements java.sql.ResultSet { public void setFetchSize(int fsize) throws SQLException { if (fsize != 1) { - throw new SQLException("not supported"); + throw new SQLException("fetch size must be 1"); } } @@ -535,18 +535,20 @@ public class JDBCResultSet implements java.sql.ResultSet { @Deprecated public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } @Deprecated public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(columnName); + return getUnicodeStream(col); } public java.io.InputStream getAsciiStream(String columnName) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(columnName); + return getAsciiStream(col); } public java.io.InputStream getAsciiStream(int columnIndex) @@ -556,23 +558,25 @@ public class JDBCResultSet implements java.sql.ResultSet { public BigDecimal getBigDecimal(String columnName) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(columnName); + return getBigDecimal(col); } @Deprecated public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(columnName); + return getBigDecimal(col, scale); } public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } @Deprecated public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public java.io.InputStream getBinaryStream(int columnIndex) @@ -598,7 +602,8 @@ public class JDBCResultSet implements java.sql.ResultSet { } public byte getByte(String columnName) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(columnName); + return getByte(col); } public byte[] getBytes(int columnIndex) throws SQLException { @@ -668,44 +673,49 @@ public class JDBCResultSet implements java.sql.ResultSet { public Object getObject(int columnIndex, java.util.Map map) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } - public Object getObject(String columnIndex, java.util.Map map) + public Object getObject(String columnName, java.util.Map map) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(columnName); + return getObject(col, map); } public java.sql.Ref getRef(int columnIndex) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } - public java.sql.Ref getRef(String columnIndex) throws SQLException { - throw new SQLException("not supported"); + public java.sql.Ref getRef(String columnName) throws SQLException { + int col = findColumn(columnName); + return getRef(col); } public java.sql.Blob getBlob(int columnIndex) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } - public java.sql.Blob getBlob(String columnIndex) throws SQLException { - throw new SQLException("not supported"); + public java.sql.Blob getBlob(String columnName) throws SQLException { + int col = findColumn(columnName); + return getBlob(col); } public java.sql.Clob getClob(int columnIndex) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } - public java.sql.Clob getClob(String columnIndex) throws SQLException { - throw new SQLException("not supported"); + public java.sql.Clob getClob(String columnName) throws SQLException { + int col = findColumn(columnName); + return getClob(col); } public java.sql.Array getArray(int columnIndex) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } - public java.sql.Array getArray(String columnIndex) throws SQLException { - throw new SQLException("not supported"); + public java.sql.Array getArray(String columnName) throws SQLException { + int col = findColumn(columnName); + return getArray(col); } public java.io.Reader getCharacterStream(int columnIndex) @@ -1004,7 +1014,7 @@ public class JDBCResultSet implements java.sql.ResultSet { } public void updateByte(int colIndex, byte b) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateShort(int colIndex, short b) throws SQLException { @@ -1054,7 +1064,7 @@ public class JDBCResultSet implements java.sql.ResultSet { public void updateBigDecimal(int colIndex, BigDecimal f) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateString(int colIndex, String s) throws SQLException { @@ -1109,17 +1119,17 @@ public class JDBCResultSet implements java.sql.ResultSet { public void updateAsciiStream(int colIndex, java.io.InputStream in, int s) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateBinaryStream(int colIndex, java.io.InputStream in, int s) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateCharacterStream(int colIndex, java.io.Reader in, int s) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateObject(int colIndex, Object obj) throws SQLException { @@ -1142,7 +1152,8 @@ public class JDBCResultSet implements java.sql.ResultSet { } public void updateByte(String colName, byte b) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateByte(col, b); } public void updateShort(String colName, short b) throws SQLException { @@ -1172,7 +1183,8 @@ public class JDBCResultSet implements java.sql.ResultSet { public void updateBigDecimal(String colName, BigDecimal f) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateBigDecimal(col, f); } public void updateString(String colName, String s) throws SQLException { @@ -1206,19 +1218,22 @@ public class JDBCResultSet implements java.sql.ResultSet { public void updateAsciiStream(String colName, java.io.InputStream in, int s) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateAsciiStream(col, in, s); } public void updateBinaryStream(String colName, java.io.InputStream in, int s) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateBinaryStream(col, in, s); } public void updateCharacterStream(String colName, java.io.Reader in, int s) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateCharacterStream(col, in, s); } public void updateObject(String colName, Object obj) @@ -1273,42 +1288,319 @@ public class JDBCResultSet implements java.sql.ResultSet { } public void updateRef(int colIndex, java.sql.Ref x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateRef(String colName, java.sql.Ref x) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateRef(col, x); } public void updateBlob(int colIndex, java.sql.Blob x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateBlob(String colName, java.sql.Blob x) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateBlob(col, x); } public void updateClob(int colIndex, java.sql.Clob x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateClob(String colName, java.sql.Clob x) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateClob(col, x); } public void updateArray(int colIndex, java.sql.Array x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void updateArray(String colName, java.sql.Array x) throws SQLException { - throw new SQLException("not supported"); + int col = findColumn(colName); + updateArray(col, x); + } + + public RowId getRowId(int colIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public RowId getRowId(String colName) throws SQLException { + int col = findColumn(colName); + return getRowId(col); + } + + public void updateRowId(int colIndex, RowId x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateRowId(String colName, RowId x) throws SQLException { + int col = findColumn(colName); + updateRowId(col, x); + } + + public int getHoldability() throws SQLException { + return ResultSet.CLOSE_CURSORS_AT_COMMIT; + } + + public boolean isClosed() throws SQLException { + return tr == null; + } + + public void updateNString(int colIndex, String nString) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNString(String colName, String nString) + throws SQLException { + int col = findColumn(colName); + updateNString(col, nString); + } + + public void updateNClob(int colIndex, NClob nclob) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNClob(String colName, NClob nclob) + throws SQLException { + int col = findColumn(colName); + updateNClob(col, nclob); + } + + public NClob getNClob(int colIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public NClob getNClob(String colName) throws SQLException { + int col = findColumn(colName); + return getNClob(col); + } + + public SQLXML getSQLXML(int colIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public SQLXML getSQLXML(String colName) throws SQLException { + int col = findColumn(colName); + return getSQLXML(col); + } + + public void updateSQLXML(int colIndex, SQLXML xml) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateSQLXML(String colName, SQLXML xml) + throws SQLException { + int col = findColumn(colName); + updateSQLXML(col, xml); + } + + public String getNString(int colIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public String getNString(String colName) throws SQLException { + int col = findColumn(colName); + return getNString(col); + } + + public java.io.Reader getNCharacterStream(int colIndex) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public java.io.Reader getNCharacterStream(String colName) + throws SQLException { + int col = findColumn(colName); + return getNCharacterStream(col); + } + + public void updateNCharacterStream(int colIndex, java.io.Reader x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNCharacterStream(String colName, java.io.Reader x, + long len) + throws SQLException { + int col = findColumn(colName); + updateNCharacterStream(col, x, len); + } + + public void updateAsciiStream(int colIndex, java.io.InputStream x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateAsciiStream(String colName, java.io.InputStream x, + long len) + throws SQLException { + int col = findColumn(colName); + updateAsciiStream(col, x, len); + } + + public void updateBinaryStream(int colIndex, java.io.InputStream x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBinaryStream(String colName, java.io.InputStream x, + long len) + throws SQLException { + int col = findColumn(colName); + updateBinaryStream(col, x, len); + } + + public void updateCharacterStream(int colIndex, java.io.Reader x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateCharacterStream(String colName, java.io.Reader x, + long len) + throws SQLException { + int col = findColumn(colName); + updateCharacterStream(col, x, len); + } + + public void updateBlob(int colIndex, java.io.InputStream x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBlob(String colName, java.io.InputStream x, + long len) + throws SQLException { + int col = findColumn(colName); + updateBlob(col, x, len); + } + + public void updateClob(int colIndex, java.io.Reader x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateClob(String colName, java.io.Reader x, + long len) + throws SQLException { + int col = findColumn(colName); + updateClob(col, x, len); + } + + public void updateNClob(int colIndex, java.io.Reader x, + long len) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNClob(String colName, java.io.Reader x, + long len) + throws SQLException { + int col = findColumn(colName); + updateNClob(col, x, len); + } + + public void updateNCharacterStream(int colIndex, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNCharacterStream(String colName, java.io.Reader x) + throws SQLException { + int col = findColumn(colName); + updateNCharacterStream(col, x); + } + + public void updateAsciiStream(int colIndex, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateAsciiStream(String colName, java.io.InputStream x) + throws SQLException { + int col = findColumn(colName); + updateAsciiStream(col, x); + } + + public void updateBinaryStream(int colIndex, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBinaryStream(String colName, java.io.InputStream x) + throws SQLException { + int col = findColumn(colName); + updateBinaryStream(col, x); + } + + public void updateCharacterStream(int colIndex, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateCharacterStream(String colName, java.io.Reader x) + throws SQLException { + int col = findColumn(colName); + updateCharacterStream(col, x); + } + + public void updateBlob(int colIndex, java.io.InputStream x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBlob(String colName, java.io.InputStream x) + throws SQLException { + int col = findColumn(colName); + updateBlob(col, x); + } + + public void updateClob(int colIndex, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateClob(String colName, java.io.Reader x) + throws SQLException { + int col = findColumn(colName); + updateClob(col, x); + } + + public void updateNClob(int colIndex, java.io.Reader x) + throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNClob(String colName, java.io.Reader x) + throws SQLException { + int col = findColumn(colName); + updateNClob(col, x); + } + + public <T> T unwrap(java.lang.Class<T> iface) throws SQLException { + throw new SQLException("unsupported"); + } + + public boolean isWrapperFor(java.lang.Class iface) throws SQLException { + return false; } } diff --git a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCResultSetMetaData.java b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCResultSetMetaData.java index 40be126..b77587e 100644 --- a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCResultSetMetaData.java +++ b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCResultSetMetaData.java @@ -1,4 +1,4 @@ -package SQLite.JDBC2y; +package SQLite.JDBC2z; import java.sql.*; @@ -211,4 +211,13 @@ public class JDBCResultSetMetaData implements java.sql.ResultSetMetaData { } throw new SQLException("column " + columnName + " not found"); } + + public <T> T unwrap(java.lang.Class<T> iface) throws SQLException { + throw new SQLException("unsupported"); + } + + public boolean isWrapperFor(java.lang.Class iface) throws SQLException { + return false; + } + } diff --git a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCStatement.java b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCStatement.java index 0b5b26f..65e0728 100644 --- a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/JDBCStatement.java +++ b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/JDBCStatement.java @@ -1,4 +1,4 @@ -package SQLite.JDBC2y; +package SQLite.JDBC2z; import java.sql.*; import java.util.*; @@ -15,11 +15,13 @@ public class JDBCStatement implements java.sql.Statement { this.conn = conn; this.updcnt = 0; this.rs = null; - this.batch = null; + this.batch = null; } public void setFetchSize(int fetchSize) throws SQLException { - throw new SQLException("not supported"); + if (fetchSize != 1) { + throw new SQLException("fetch size not 1"); + } } public int getFetchSize() throws SQLException { @@ -31,11 +33,11 @@ public class JDBCStatement implements java.sql.Statement { } public void setMaxRows(int max) throws SQLException { - // BEGIN android-added: missing error checking. - if (max < 0) { - throw new SQLException("max must be >= 0 (was " + max + ")"); - } - // END android-added + // BEGIN android-added: missing error checking. + if (max < 0) { + throw new SQLException("max must be >= 0 (was " + max + ")"); + } + // END android-added maxrows = max; } @@ -231,7 +233,7 @@ public class JDBCStatement implements java.sql.Statement { } public void setCursorName(String name) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public void setEscapeProcessing(boolean enable) throws SQLException { @@ -243,51 +245,73 @@ public class JDBCStatement implements java.sql.Statement { } public boolean getMoreResults(int x) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public ResultSet getGeneratedKeys() throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public int executeUpdate(String sql, int autokeys) throws SQLException { if (autokeys != Statement.NO_GENERATED_KEYS) { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException("generated keys not supported"); } return executeUpdate(sql); } public int executeUpdate(String sql, int colIndexes[]) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public int executeUpdate(String sql, String colIndexes[]) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public boolean execute(String sql, int autokeys) throws SQLException { if (autokeys != Statement.NO_GENERATED_KEYS) { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException("autogenerated keys not supported"); } return execute(sql); } public boolean execute(String sql, int colIndexes[]) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public boolean execute(String sql, String colIndexes[]) throws SQLException { - throw new SQLException("not supported"); + throw new SQLFeatureNotSupportedException(); } public int getResultSetHoldability() throws SQLException { return ResultSet.HOLD_CURSORS_OVER_COMMIT; } + public boolean isClosed() throws SQLException { + return rs == null; + } + + public void setPoolable(boolean yes) throws SQLException { + if (yes) { + throw new SQLException("poolable statements not supported"); + } + } + + public boolean isPoolable() throws SQLException { + return false; + } + + public <T> T unwrap(java.lang.Class<T> iface) throws SQLException { + throw new SQLException("unsupported"); + } + + public boolean isWrapperFor(java.lang.Class iface) throws SQLException { + return false; + } + } diff --git a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/TableResultX.java b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/TableResultX.java index 1414fc0..5705ced 100644 --- a/sqlite-jdbc/src/main/java/SQLite/JDBC2y/TableResultX.java +++ b/sqlite-jdbc/src/main/java/SQLite/JDBC2z/TableResultX.java @@ -1,4 +1,4 @@ -package SQLite.JDBC2y; +package SQLite.JDBC2z; import java.sql.Types; import java.util.Vector; diff --git a/sqlite-jdbc/src/main/java/SQLite/Stmt.java b/sqlite-jdbc/src/main/java/SQLite/Stmt.java index f959ed2..5a6e7c2 100644 --- a/sqlite-jdbc/src/main/java/SQLite/Stmt.java +++ b/sqlite-jdbc/src/main/java/SQLite/Stmt.java @@ -227,7 +227,7 @@ public class Stmt { public Object column(int col) throws SQLite.Exception { switch (column_type(col)) { case Constants.SQLITE_INTEGER: - return Long.valueOf(column_long(col)); // android-changed: performance + return Long.valueOf(column_long(col)); // android-changed: performance; case Constants.SQLITE_FLOAT: return new Double(column_double(col)); case Constants.SQLITE_BLOB: |