diff options
author | smallsql <smallsql> | 2009-01-16 00:40:00 +0300 |
---|---|---|
committer | smallsql <smallsql> | 2009-01-16 00:40:00 +0300 |
commit | 58e46aa14c1044996bdf09cd141d9c23f9ec847b (patch) | |
tree | 4eacafc454d6eb7dbe5b86a7b9ffa85659aa66b3 /openjdk/sun/jdbc/odbc | |
parent | b211941b7a0064bcc3cf2814f794783f32f5afc4 (diff) |
First Step of the JDBC ODBC Bridge
Diffstat (limited to 'openjdk/sun/jdbc/odbc')
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java | 714 | ||||
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java | 411 | ||||
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java | 1107 | ||||
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcDriver.java | 76 | ||||
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcMetaResultSet.java | 1192 | ||||
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java | 336 | ||||
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java | 1235 | ||||
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcResultSetMetaData.java | 178 | ||||
-rw-r--r-- | openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java | 305 |
9 files changed, 5554 insertions, 0 deletions
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java b/openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java new file mode 100644 index 00000000..f5c8b99e --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java @@ -0,0 +1,714 @@ +/* + Copyright (C) 2009 Volker Berlin (i-net software) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jeroen Frijters + jeroen@frijters.net + + */ +package sun.jdbc.odbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +import cli.System.Data.Common.*; + + + +/** + * @author Volker Berlin + */ +public class JdbcOdbcCallableStatement extends JdbcOdbcPreparedStatement implements CallableStatement{ + + public JdbcOdbcCallableStatement(JdbcOdbcConnection jdbcConn, DbCommand command, String sql){ + super(jdbcConn, command, sql); + // TODO Auto-generated constructor stub + } + + + public Array getArray(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Array getArray(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Blob getBlob(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Blob getBlob(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public boolean getBoolean(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean getBoolean(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public byte getByte(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public byte getByte(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public byte[] getBytes(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public byte[] getBytes(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Reader getCharacterStream(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Reader getCharacterStream(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Clob getClob(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Clob getClob(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(String parameterName, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public double getDouble(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public double getDouble(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public float getFloat(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public float getFloat(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getInt(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getInt(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public long getLong(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public long getLong(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public Reader getNCharacterStream(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Reader getNCharacterStream(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public NClob getNClob(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public NClob getNClob(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getNString(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getNString(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(int parameterIndex, Map<String, Class<?>> map) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Ref getRef(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Ref getRef(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public RowId getRowId(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public RowId getRowId(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLXML getSQLXML(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLXML getSQLXML(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public short getShort(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public short getShort(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public String getString(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getString(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(String parameterName, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public URL getURL(int parameterIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public URL getURL(String parameterName) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBlob(String parameterName, Blob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBoolean(String parameterName, boolean x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setByte(String parameterName, byte x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setBytes(String parameterName, byte[] x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setClob(String parameterName, Clob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setClob(String parameterName, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setClob(String parameterName, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setDate(String parameterName, Date x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setDouble(String parameterName, double x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setFloat(String parameterName, float x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setInt(String parameterName, int x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setLong(String parameterName, long x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setNClob(String parameterName, NClob value) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setNClob(String parameterName, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setNString(String parameterName, String value) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setNull(String parameterName, int sqlType) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setObject(String parameterName, Object x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setRowId(String parameterName, RowId x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setShort(String parameterName, short x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setString(String parameterName, String x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setTime(String parameterName, Time x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setURL(String parameterName, URL val) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean wasNull() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + +} diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java b/openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java new file mode 100644 index 00000000..e49f508d --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java @@ -0,0 +1,411 @@ +/* + Copyright (C) 2009 Volker Berlin (i-net software) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jeroen Frijters + jeroen@frijters.net + + */ +package sun.jdbc.odbc; + +import cli.System.Data.*; +import cli.System.Data.Common.*; +import cli.System.Data.Odbc.*; + +import java.sql.*; +import java.util.Map; +import java.util.Properties; + +/** + * This JDBC Driver is a wrapper to the ODBC.NET Data Provider + */ +public class JdbcOdbcConnection implements Connection{ + + private final DbConnection netConn; + + private DbTransaction transaction; + + private int isolation = TRANSACTION_READ_COMMITTED; + + + JdbcOdbcConnection(String connectString, Properties info) throws SQLException{ + boolean isDSN = connectString.indexOf('=') < 0; + StringBuilder connStr = new StringBuilder(); + if(isDSN){ + connStr.append("DSN="); + } + connStr.append(connectString); + + String uid = info.getProperty("user"); + String pwd = info.getProperty("password"); + + if(uid != null){ + connStr.append(";UID=").append(uid); + } + if(pwd != null){ + connStr.append(";PWD=").append(pwd); + } + + netConn = new OdbcConnection(connStr.toString()); + + netConn.Open(); + } + + + public void clearWarnings() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void close() throws SQLException{ + try{ + netConn.Close(); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public Array createArrayOf(String typeName, Object[] elements) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Blob createBlob() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Clob createClob() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public NClob createNClob() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLXML createSQLXML() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Statement createStatement() throws SQLException{ + try{ + return new JdbcOdbcStatement(this, netConn.CreateCommand()); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Struct createStruct(String typeName, Object[] attributes) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public void setAutoCommit(boolean autoCommit) throws SQLException{ + try{ + if(autoCommit && transaction != null){ + return; // no change + } + if(!autoCommit && transaction == null){ + return; // no change + } + int level; + switch(isolation){ + case TRANSACTION_READ_COMMITTED: + level = IsolationLevel.ReadUncommitted; + break; + case TRANSACTION_READ_UNCOMMITTED: + level = IsolationLevel.ReadCommitted; + break; + case TRANSACTION_REPEATABLE_READ: + level = IsolationLevel.RepeatableRead; + break; + case TRANSACTION_SERIALIZABLE: + level = IsolationLevel.Serializable; + break; + default: + level = IsolationLevel.ReadCommitted; + } + if(autoCommit){ + transaction = netConn.BeginTransaction(IsolationLevel.wrap(level)); + }else{ + transaction.Commit(); + transaction = null; + } + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public boolean getAutoCommit(){ + return transaction != null; + } + + + public void commit() throws SQLException{ + try{ + if(transaction == null){ + // auto commit == true + return; + } + transaction.Commit(); + transaction = netConn.BeginTransaction(transaction.get_IsolationLevel()); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public void rollback() throws SQLException{ + try{ + if(transaction == null){ + // auto commit == true + return; + } + transaction.Rollback(); + transaction = netConn.BeginTransaction(transaction.get_IsolationLevel()); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public void setTransactionIsolation(int level){ + isolation = level; + } + + + public int getTransactionIsolation(){ + return isolation; + } + + + public String getClientInfo(String name) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Properties getClientInfo() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getHoldability() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public DatabaseMetaData getMetaData() throws SQLException{ + // TODO Auto-generated method stub + return new JdbcOdbcDatabaseMetaData(netConn); + } + + + public Map<String, Class<?>> getTypeMap() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLWarning getWarnings() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public boolean isClosed() throws SQLException{ + return netConn.get_State().Value == ConnectionState.Closed; + } + + + public boolean isReadOnly() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isValid(int timeout) throws SQLException{ + // TODO Auto-generated method stub + return true; + } + + + public String nativeSQL(String sql) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public CallableStatement prepareCall(String sql) throws SQLException{ + return new JdbcOdbcCallableStatement(this, netConn.CreateCommand(), sql); + } + + + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, + int resultSetHoldability) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public PreparedStatement prepareStatement(String sql) throws SQLException{ + return new JdbcOdbcPreparedStatement(this, netConn.CreateCommand(), sql); + } + + + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, + int resultSetHoldability) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public void releaseSavepoint(Savepoint savepoint) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void rollback(Savepoint savepoint) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setCatalog(String catalog) throws SQLException{ + netConn.ChangeDatabase(catalog); + } + + + public String getCatalog() throws SQLException{ + return netConn.get_Database(); + } + + + public void setClientInfo(String name, String value) throws SQLClientInfoException{ + // TODO Auto-generated method stub + + } + + + public void setClientInfo(Properties properties) throws SQLClientInfoException{ + // TODO Auto-generated method stub + + } + + + public void setHoldability(int holdability) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setReadOnly(boolean readOnly) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public Savepoint setSavepoint(){ + throw new UnsupportedOperationException(); + } + + + public Savepoint setSavepoint(String name){ + throw new UnsupportedOperationException(); + } + + + public void setTypeMap(Map<String, Class<?>> map) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean isWrapperFor(Class<?> iface){ + return iface.isAssignableFrom(this.getClass()); + } + + + public <T>T unwrap(Class<T> iface) throws SQLException{ + if(isWrapperFor(iface)){ + return (T)this; + } + throw new SQLException(this.getClass().getName() + " does not implements " + iface.getName() + ".", "01000"); + } + +} diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java b/openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java new file mode 100644 index 00000000..48e08525 --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java @@ -0,0 +1,1107 @@ +/* + Copyright (C) 2009 Volker Berlin (i-net software) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jeroen Frijters + jeroen@frijters.net + + */ +package sun.jdbc.odbc; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.RowIdLifetime; +import java.sql.SQLException; + +import cli.System.Data.*; +import cli.System.Data.Common.*; +import cli.System.Data.Odbc.*; + +/** + * @author Volker Berlin + */ +public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{ + + private final DbConnection netConn; + + + public JdbcOdbcDatabaseMetaData(DbConnection netConn){ + this.netConn = netConn; + } + + + public boolean allProceduresAreCallable() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean allTablesAreSelectable() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean autoCommitFailureClosesAllResultSets() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean dataDefinitionCausesTransactionCommit() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean dataDefinitionIgnoredInTransactions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean deletesAreDetected(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean doesMaxRowSizeIncludeBlobs() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, + String attributeNamePattern) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getCatalogSeparator() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getCatalogTerm() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getCatalogs() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getClientInfoProperties() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Connection getConnection() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, + String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getDatabaseMajorVersion() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getDatabaseMinorVersion() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public String getDatabaseProductName() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getDatabaseProductVersion() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getDefaultTransactionIsolation() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getDriverMajorVersion(){ + // TODO Auto-generated method stub + return 0; + } + + + public int getDriverMinorVersion(){ + // TODO Auto-generated method stub + return 0; + } + + + public String getDriverName() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getDriverVersion() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getExtraNameCharacters() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, + String columnNamePattern) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getIdentifierQuoteString() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getJDBCMajorVersion() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getJDBCMinorVersion() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxBinaryLiteralLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxCatalogNameLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxCharLiteralLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxColumnNameLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxColumnsInGroupBy() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxColumnsInIndex() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxColumnsInOrderBy() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxColumnsInSelect() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxColumnsInTable() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxConnections() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxCursorNameLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxIndexLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxProcedureNameLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxRowSize() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxSchemaNameLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxStatementLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxStatements() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxTableNameLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxTablesInSelect() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxUserNameLength() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public String getNumericFunctions() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, + String columnNamePattern) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getProcedureTerm() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) + throws SQLException{ + // the description of the restrictions can you request with GetSchema("Restrictions") + String[] restrictions = new String[]{catalog, schemaPattern, procedureNamePattern}; + DataTable data = netConn.GetSchema(OdbcMetaDataCollectionNames.Procedures, restrictions); + return new JdbcOdbcMetaResultSet(data); + } + + + public int getResultSetHoldability() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public RowIdLifetime getRowIdLifetime() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getSQLKeywords() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getSQLStateType() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public String getSchemaTerm() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getSchemas() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getSearchStringEscape() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getStringFunctions() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getSystemFunctions() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getTableTypes() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getTimeDateFunctions() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getTypeInfo() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) + throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getURL() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getUserName() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public boolean insertsAreDetected(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isCatalogAtStart() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isReadOnly() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean locatorsUpdateCopy() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean nullPlusNonNullIsNull() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean nullsAreSortedAtEnd() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean nullsAreSortedAtStart() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean nullsAreSortedHigh() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean nullsAreSortedLow() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean othersDeletesAreVisible(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean othersInsertsAreVisible(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean othersUpdatesAreVisible(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean ownDeletesAreVisible(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean ownInsertsAreVisible(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean ownUpdatesAreVisible(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean storesLowerCaseIdentifiers() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean storesLowerCaseQuotedIdentifiers() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean storesMixedCaseIdentifiers() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean storesMixedCaseQuotedIdentifiers() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean storesUpperCaseIdentifiers() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean storesUpperCaseQuotedIdentifiers() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsANSI92EntryLevelSQL() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsANSI92FullSQL() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsANSI92IntermediateSQL() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsAlterTableWithAddColumn() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsAlterTableWithDropColumn() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsBatchUpdates() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsCatalogsInDataManipulation() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsCatalogsInIndexDefinitions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsCatalogsInProcedureCalls() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsCatalogsInTableDefinitions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsColumnAliasing() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsConvert() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsConvert(int fromType, int toType) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsCoreSQLGrammar() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsCorrelatedSubqueries() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsDataManipulationTransactionsOnly() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsDifferentTableCorrelationNames() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsExpressionsInOrderBy() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsExtendedSQLGrammar() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsFullOuterJoins() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsGetGeneratedKeys() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsGroupBy() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsGroupByBeyondSelect() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsGroupByUnrelated() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsIntegrityEnhancementFacility() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsLikeEscapeClause() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsLimitedOuterJoins() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsMinimumSQLGrammar() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsMixedCaseIdentifiers() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsMultipleOpenResults() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsMultipleResultSets() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsMultipleTransactions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsNamedParameters() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsNonNullableColumns() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsOpenCursorsAcrossCommit() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsOpenCursorsAcrossRollback() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsOpenStatementsAcrossCommit() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsOpenStatementsAcrossRollback() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsOrderByUnrelated() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsOuterJoins() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsPositionedDelete() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsPositionedUpdate() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsResultSetHoldability(int holdability) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsResultSetType(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSavepoints() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSchemasInDataManipulation() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSchemasInIndexDefinitions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSchemasInProcedureCalls() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSchemasInTableDefinitions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSelectForUpdate() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsStatementPooling() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsStoredProcedures() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSubqueriesInComparisons() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSubqueriesInExists() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSubqueriesInIns() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsSubqueriesInQuantifieds() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsTableCorrelationNames() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsTransactionIsolationLevel(int level) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsTransactions() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsUnion() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean supportsUnionAll() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean updatesAreDetected(int type) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean usesLocalFilePerTable() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean usesLocalFiles() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isWrapperFor(Class<?> iface){ + return iface.isAssignableFrom(this.getClass()); + } + + + public <T>T unwrap(Class<T> iface) throws SQLException{ + if(isWrapperFor(iface)){ + return (T)this; + } + throw new SQLException(this.getClass().getName() + " does not implements " + iface.getName() + ".", "01000"); + } + +} diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcDriver.java b/openjdk/sun/jdbc/odbc/JdbcOdbcDriver.java new file mode 100644 index 00000000..572595db --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcDriver.java @@ -0,0 +1,76 @@ +/* + * Created on 07.01.2009 + */ +package sun.jdbc.odbc; + +import java.sql.*; +import java.util.Properties; + +/** + * This JDBC Driver is a wrapper to the ODBC.NET Data Provider + */ +public class JdbcOdbcDriver implements Driver{ + + private static final String URL_PREFIX = "jdbc:odbc:"; + + static{ + try{ + DriverManager.registerDriver(new JdbcOdbcDriver()); + }catch(SQLException ex){ + throw new ExceptionInInitializerError(ex); + } + } + + + /** + * {@inheritDoc} + */ + public boolean acceptsURL(String url){ + return url.startsWith(URL_PREFIX); + } + + + /** + * {@inheritDoc} + */ + public Connection connect(String url, Properties info) throws SQLException{ + if(!acceptsURL(url)){ + return null; + } + String connectString = url.substring(URL_PREFIX.length()); + return new JdbcOdbcConnection(connectString, info); + } + + + /** + * {@inheritDoc} + */ + public int getMajorVersion(){ + return 2; + } + + + /** + * {@inheritDoc} + */ + public int getMinorVersion(){ + return 1; + } + + + /** + * {@inheritDoc} + */ + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException{ + return new DriverPropertyInfo[0]; + } + + + /** + * {@inheritDoc} + */ + public boolean jdbcCompliant(){ + return true; + } + +} diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcMetaResultSet.java b/openjdk/sun/jdbc/odbc/JdbcOdbcMetaResultSet.java new file mode 100644 index 00000000..bf4090ec --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcMetaResultSet.java @@ -0,0 +1,1192 @@ +/* + Copyright (C) 2009 Volker Berlin (i-net software) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jeroen Frijters + jeroen@frijters.net + + */ +package sun.jdbc.odbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +import cli.System.Data.*; + +/** + * @author Volker Berlin + */ +public class JdbcOdbcMetaResultSet implements ResultSet{ + + private final DataTable data; + private final DataRowCollection rows; + private int rowIndex; // row index starting with 0; + private cli.System.Data.DataRow row; + + public JdbcOdbcMetaResultSet(DataTable data){ + this.data = data; + this.rows = data.get_Rows(); + this.rowIndex = -1; + } + + + public boolean absolute(int row) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void afterLast() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void beforeFirst() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void cancelRowUpdates() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void clearWarnings() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void close() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void deleteRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public int findColumn(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public boolean first() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public Array getArray(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Array getArray(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getAsciiStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getAsciiStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getBinaryStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getBinaryStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Blob getBlob(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Blob getBlob(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public boolean getBoolean(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean getBoolean(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public byte getByte(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public byte getByte(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public byte[] getBytes(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public byte[] getBytes(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Reader getCharacterStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Reader getCharacterStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Clob getClob(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Clob getClob(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getConcurrency() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public String getCursorName() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(int columnIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(String columnLabel, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public double getDouble(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public double getDouble(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getFetchDirection() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getFetchSize() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public float getFloat(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public float getFloat(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getHoldability() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getInt(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getInt(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public long getLong(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public long getLong(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public ResultSetMetaData getMetaData(){ + return new JdbcOdbcResultSetMetaData(null, data); + } + + + public Reader getNCharacterStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Reader getNCharacterStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public NClob getNClob(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public NClob getNClob(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getNString(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getNString(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(int columnIndex) throws SQLException{ + if(row == null){ + throw new SQLException("No current row", "S1109"); + } + return row.get_Item(columnIndex - 1); + } + + + public Object getObject(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Ref getRef(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Ref getRef(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getRow(){ + return rowIndex < rows.get_Count() ? rowIndex + 1 : 0; + } + + + public RowId getRowId(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public RowId getRowId(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLXML getSQLXML(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLXML getSQLXML(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public short getShort(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public short getShort(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public Statement getStatement() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getString(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getString(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(int columnIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(String columnLabel, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getType() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public URL getURL(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public URL getURL(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getUnicodeStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getUnicodeStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLWarning getWarnings() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public void insertRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean isAfterLast() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isBeforeFirst() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isClosed() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isFirst() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isLast() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean last() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void moveToCurrentRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void moveToInsertRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean next() throws SQLException{ + if( rowIndex + 1 < rows.get_Count()){ + rowIndex++; + row = rows.get_Item(rowIndex); + return true; + }else{ + row = null; + return false; + } + } + + + public boolean previous() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void refreshRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean relative(int rows) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean rowDeleted() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean rowInserted() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean rowUpdated() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void setFetchDirection(int direction) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setFetchSize(int rows) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateArray(int columnIndex, Array x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateArray(String columnLabel, Array x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(int columnIndex, Blob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(String columnLabel, Blob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBoolean(int columnIndex, boolean x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBoolean(String columnLabel, boolean x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateByte(int columnIndex, byte x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateByte(String columnLabel, byte x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBytes(int columnIndex, byte[] x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBytes(String columnLabel, byte[] x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(int columnIndex, Clob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(String columnLabel, Clob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(int columnIndex, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(String columnLabel, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateDate(int columnIndex, Date x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateDate(String columnLabel, Date x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateDouble(int columnIndex, double x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateDouble(String columnLabel, double x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateFloat(int columnIndex, float x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateFloat(String columnLabel, float x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateInt(int columnIndex, int x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateInt(String columnLabel, int x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateLong(int columnIndex, long x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateLong(String columnLabel, long x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(int columnIndex, NClob clob) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(String columnLabel, NClob clob) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(int columnIndex, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(String columnLabel, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNString(int columnIndex, String string) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNString(String columnLabel, String string) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNull(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNull(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateObject(int columnIndex, Object x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateObject(String columnLabel, Object x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRef(int columnIndex, Ref x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRef(String columnLabel, Ref x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRowId(int columnIndex, RowId x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRowId(String columnLabel, RowId x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateShort(int columnIndex, short x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateShort(String columnLabel, short x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateString(int columnIndex, String x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateString(String columnLabel, String x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateTime(int columnIndex, Time x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateTime(String columnLabel, Time x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean wasNull() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isWrapperFor(Class<?> iface) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public <T>T unwrap(Class<T> iface) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + +} diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java b/openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java new file mode 100644 index 00000000..d9a2254d --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java @@ -0,0 +1,336 @@ +/* + Copyright (C) 2009 Volker Berlin (i-net software) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jeroen Frijters + jeroen@frijters.net + + */ +package sun.jdbc.odbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.ParameterMetaData; +import java.sql.PreparedStatement; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLXML; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; + +import cli.System.Data.Common.DbCommand; + + + +/** + * @author Volker Berlin + */ +public class JdbcOdbcPreparedStatement extends JdbcOdbcStatement implements PreparedStatement{ + + public JdbcOdbcPreparedStatement(JdbcOdbcConnection jdbcConn, DbCommand command, String sql){ + super(jdbcConn, command); + command.set_CommandText(sql); + } + + public void addBatch() throws SQLException{ + // TODO Auto-generated method stub + + } + + public void clearParameters() throws SQLException{ + // TODO Auto-generated method stub + + } + + public boolean execute() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + public ResultSet executeQuery() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + public int executeUpdate() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + public ResultSetMetaData getMetaData() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + public ParameterMetaData getParameterMetaData() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + public void setArray(int parameterIndex, Array x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setByte(int parameterIndex, byte x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setClob(int parameterIndex, Clob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setDate(int parameterIndex, Date x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setDouble(int parameterIndex, double x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setFloat(int parameterIndex, float x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setInt(int parameterIndex, int x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setLong(int parameterIndex, long x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setNString(int parameterIndex, String value) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setObject(int parameterIndex, Object x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setRef(int parameterIndex, Ref x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setShort(int parameterIndex, short x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setString(int parameterIndex, String x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setTime(int parameterIndex, Time x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setURL(int parameterIndex, URL x) throws SQLException{ + // TODO Auto-generated method stub + + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + +} diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java b/openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java new file mode 100644 index 00000000..45ba0416 --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java @@ -0,0 +1,1235 @@ +/* + Copyright (C) 2009 Volker Berlin (i-net software) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jeroen Frijters + jeroen@frijters.net + + */ +package sun.jdbc.odbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +import cli.System.Data.Common.DbDataReader; + +/** + * This JDBC Driver is a wrapper to the ODBC.NET Data Provider + */ +public class JdbcOdbcResultSet implements ResultSet{ + + private final DbDataReader reader; + + private final JdbcOdbcStatement statement; + + private boolean wasNull; + + + public JdbcOdbcResultSet(JdbcOdbcStatement statement, DbDataReader reader){ + this.statement = statement; + this.reader = reader; + } + + + public boolean absolute(int row) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void afterLast() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void beforeFirst() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void cancelRowUpdates() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void clearWarnings() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void close() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void deleteRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public int findColumn(String columnLabel) throws SQLException{ + return reader.GetOrdinal(columnLabel) + 1; + } + + + public boolean first() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public Array getArray(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Array getArray(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getAsciiStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getAsciiStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public BigDecimal getBigDecimal(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getBinaryStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getBinaryStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Blob getBlob(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Blob getBlob(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public boolean getBoolean(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean getBoolean(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public byte getByte(int columnIndex) throws SQLException{ + try{ + columnIndex--; + if(reader.IsDBNull(columnIndex)){ + wasNull = true; + return 0; + } + return reader.GetByte(columnIndex); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public byte getByte(String columnLabel) throws SQLException{ + return getByte(findColumn(columnLabel)); + } + + + public byte[] getBytes(int columnIndex) throws SQLException{ + try{ + columnIndex--; + if(reader.IsDBNull(columnIndex)){ + wasNull = true; + return null; + } + int count = (int)reader.GetBytes(columnIndex, 0, null, 0, 0); + byte[] buffer = new byte[count]; + reader.GetBytes(columnIndex, 0, buffer, 0, buffer.length); + return buffer; + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public byte[] getBytes(String columnLabel) throws SQLException{ + return getBytes(findColumn(columnLabel)); + } + + + public Reader getCharacterStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Reader getCharacterStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Clob getClob(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Clob getClob(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getConcurrency() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public String getCursorName() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(int columnIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Date getDate(String columnLabel, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public double getDouble(int columnIndex) throws SQLException{ + try{ + columnIndex--; + if(reader.IsDBNull(columnIndex)){ + wasNull = true; + return 0; + } + return reader.GetDouble(columnIndex); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public double getDouble(String columnLabel) throws SQLException{ + return getDouble(findColumn(columnLabel)); + } + + + public int getFetchDirection() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getFetchSize() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public float getFloat(int columnIndex) throws SQLException{ + try{ + columnIndex--; + if(reader.IsDBNull(columnIndex)){ + wasNull = true; + return 0; + } + return reader.GetFloat(columnIndex); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public float getFloat(String columnLabel) throws SQLException{ + return getFloat(findColumn(columnLabel)); + } + + + public int getHoldability() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getInt(int columnIndex) throws SQLException{ + try{ + columnIndex--; + if(reader.IsDBNull(columnIndex)){ + wasNull = true; + return 0; + } + return reader.GetInt32(columnIndex); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public int getInt(String columnLabel) throws SQLException{ + return getInt(findColumn(columnLabel)); + } + + + public long getLong(int columnIndex) throws SQLException{ + try{ + columnIndex--; + if(reader.IsDBNull(columnIndex)){ + wasNull = true; + return 0; + } + return reader.GetInt64(columnIndex); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public long getLong(String columnLabel) throws SQLException{ + return getLong(findColumn(columnLabel)); + } + + + public ResultSetMetaData getMetaData(){ + return new JdbcOdbcResultSetMetaData(reader, reader.GetSchemaTable()); + } + + + public Reader getNCharacterStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Reader getNCharacterStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public NClob getNClob(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public NClob getNClob(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getNString(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getNString(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Ref getRef(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Ref getRef(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getRow() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public RowId getRowId(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public RowId getRowId(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLXML getSQLXML(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLXML getSQLXML(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public short getShort(int columnIndex) throws SQLException{ + try{ + columnIndex--; + if(reader.IsDBNull(columnIndex)){ + wasNull = true; + return 0; + } + return reader.GetInt16(columnIndex); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public short getShort(String columnLabel) throws SQLException{ + return getShort(findColumn(columnLabel)); + } + + + public Statement getStatement(){ + return statement; + } + + + public String getString(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getString(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(int columnIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Time getTime(String columnLabel, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getType() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public URL getURL(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public URL getURL(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getUnicodeStream(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public InputStream getUnicodeStream(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public SQLWarning getWarnings() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public void insertRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean isAfterLast() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isBeforeFirst() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isClosed() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isFirst() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isLast() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean last() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void moveToCurrentRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void moveToInsertRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean next() throws SQLException{ + return reader.Read(); + } + + + public boolean previous() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void refreshRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean relative(int rows) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean rowDeleted() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean rowInserted() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean rowUpdated() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void setFetchDirection(int direction) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setFetchSize(int rows) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateArray(int columnIndex, Array x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateArray(String columnLabel, Array x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(int columnIndex, Blob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(String columnLabel, Blob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBoolean(int columnIndex, boolean x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBoolean(String columnLabel, boolean x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateByte(int columnIndex, byte x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateByte(String columnLabel, byte x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBytes(int columnIndex, byte[] x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateBytes(String columnLabel, byte[] x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(int columnIndex, Clob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(String columnLabel, Clob x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(int columnIndex, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateClob(String columnLabel, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateDate(int columnIndex, Date x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateDate(String columnLabel, Date x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateDouble(int columnIndex, double x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateDouble(String columnLabel, double x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateFloat(int columnIndex, float x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateFloat(String columnLabel, float x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateInt(int columnIndex, int x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateInt(String columnLabel, int x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateLong(int columnIndex, long x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateLong(String columnLabel, long x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(int columnIndex, NClob clob) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(String columnLabel, NClob clob) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(int columnIndex, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNClob(String columnLabel, Reader reader) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNString(int columnIndex, String string) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNString(String columnLabel, String string) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNull(int columnIndex) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateNull(String columnLabel) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateObject(int columnIndex, Object x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateObject(String columnLabel, Object x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRef(int columnIndex, Ref x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRef(String columnLabel, Ref x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRow() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRowId(int columnIndex, RowId x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateRowId(String columnLabel, RowId x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateShort(int columnIndex, short x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateShort(String columnLabel, short x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateString(int columnIndex, String x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateString(String columnLabel, String x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateTime(int columnIndex, Time x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateTime(String columnLabel, Time x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean wasNull(){ + return wasNull; + } + + + public boolean isWrapperFor(Class<?> iface){ + return iface.isAssignableFrom(this.getClass()); + } + + + public <T>T unwrap(Class<T> iface) throws SQLException{ + if(isWrapperFor(iface)){ + return (T)this; + } + throw new SQLException(this.getClass().getName() + " does not implements " + iface.getName() + ".", "01000"); + } + +} diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcResultSetMetaData.java b/openjdk/sun/jdbc/odbc/JdbcOdbcResultSetMetaData.java new file mode 100644 index 00000000..8f75f868 --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcResultSetMetaData.java @@ -0,0 +1,178 @@ +/* + Copyright (C) 2009 Volker Berlin (i-net software) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jeroen Frijters + jeroen@frijters.net + + */ +package sun.jdbc.odbc; + +import java.sql.*; + +import cli.System.Data.*; +import cli.System.Data.Common.*; + +/** + * This JDBC Driver is a wrapper to the ODBC.NET Data Provider + */ +public class JdbcOdbcResultSetMetaData implements ResultSetMetaData{ + + private final DbDataReader reader; + private final DataTable table; + + + public JdbcOdbcResultSetMetaData(DbDataReader reader, DataTable table){ + this.reader = reader; + this.table = table; + } + + + public String getCatalogName(int column){ + return ""; + } + + + public String getColumnClassName(int column){ + cli.System.Type type = getDataColumn(column).get_DataType(); + return type.get_FullName(); + } + + + public int getColumnCount(){ + return table.get_Columns().get_Count(); + } + + + public int getColumnDisplaySize(int column) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public String getColumnLabel(int column) throws SQLException{ + return getDataColumn(column).get_Caption(); + } + + + public String getColumnName(int column) throws SQLException{ + return getDataColumn(column).get_ColumnName(); + } + + + public int getColumnType(int column) throws SQLException{ + cli.System.Type type = getDataColumn(column).get_DataType(); + // TODO Auto-generated method stub + return Types.OTHER; + } + + + public String getColumnTypeName(int column) throws SQLException{ + return reader != null ? reader.GetDataTypeName(column - 1) : ""; + } + + + public int getPrecision(int column) throws SQLException{ + return getDataColumn(column).get_MaxLength(); + } + + + public int getScale(int column) throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public String getSchemaName(int column) throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public String getTableName(int column) throws SQLException{ + return table.get_TableName(); + } + + + public boolean isAutoIncrement(int column) throws SQLException{ + return getDataColumn(column).get_AutoIncrement(); + } + + + public boolean isCaseSensitive(int column) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isCurrency(int column) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isDefinitelyWritable(int column) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public int isNullable(int column) throws SQLException{ + return getDataColumn(column).get_AllowDBNull() ? columnNullable : columnNoNulls; + } + + + public boolean isReadOnly(int column) throws SQLException{ + return getDataColumn(column).get_ReadOnly(); + } + + + public boolean isSearchable(int column) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isSigned(int column) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean isWritable(int column) throws SQLException{ + return !getDataColumn(column).get_ReadOnly(); + } + + + public boolean isWrapperFor(Class<?> iface){ + return iface.isAssignableFrom(this.getClass()); + } + + + public <T>T unwrap(Class<T> iface) throws SQLException{ + if(isWrapperFor(iface)){ + return (T)this; + } + throw new SQLException(this.getClass().getName() + " does not implements " + iface.getName() + ".", "01000"); + } + + + private DataColumn getDataColumn(int column){ + return table.get_Columns().get_Item(column - 1); + } +} diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java b/openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java new file mode 100644 index 00000000..d71609dc --- /dev/null +++ b/openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java @@ -0,0 +1,305 @@ +/* + Copyright (C) 2009 Volker Berlin (i-net software) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jeroen Frijters + jeroen@frijters.net + + */ +package sun.jdbc.odbc; + +import java.sql.*; + +import cli.System.Data.Common.*; + +/** + * This JDBC Driver is a wrapper to the ODBC.NET Data Provider + */ +public class JdbcOdbcStatement implements Statement{ + + private final JdbcOdbcConnection jdbcConn; + + private final DbCommand command; + + + public JdbcOdbcStatement(JdbcOdbcConnection jdbcConn, DbCommand command){ + this.jdbcConn = jdbcConn; + this.command = command; + } + + + public void addBatch(String sql) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void cancel() throws SQLException{ + try{ + command.Cancel(); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public void clearBatch() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void clearWarnings() throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void close(){ + command.Dispose(); + } + + + public boolean execute(String sql) throws SQLException{ + try{ + command.set_CommandText(sql); + DbDataReader reader = command.ExecuteReader(); + return reader != null; + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException{ + throw new UnsupportedOperationException(); + } + + + public boolean execute(String sql, int[] columnIndexes) throws SQLException{ + throw new UnsupportedOperationException(); + } + + + public boolean execute(String sql, String[] columnNames) throws SQLException{ + throw new UnsupportedOperationException(); + } + + + public int[] executeBatch() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public ResultSet executeQuery(String sql) throws SQLException{ + try{ + command.set_CommandText(sql); + return new JdbcOdbcResultSet(this, command.ExecuteReader()); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public int executeUpdate(String sql) throws SQLException{ + try{ + command.set_CommandText(sql); + return command.ExecuteNonQuery(); + }catch(Exception ex){ + throw new SQLException(ex); + } + } + + + public int executeUpdate(String sql, int autoGeneratedKeys){ + throw new UnsupportedOperationException(); + } + + + public int executeUpdate(String sql, int[] columnIndexes){ + throw new UnsupportedOperationException(); + } + + + public int executeUpdate(String sql, String[] columnNames){ + throw new UnsupportedOperationException(); + } + + + public Connection getConnection(){ + return jdbcConn; + } + + + public int getFetchDirection() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getFetchSize() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public ResultSet getGeneratedKeys(){ + throw new UnsupportedOperationException(); + } + + + public int getMaxFieldSize() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getMaxRows() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public boolean getMoreResults() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public boolean getMoreResults(int current) throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public int getQueryTimeout() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public ResultSet getResultSet() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public int getResultSetConcurrency() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getResultSetHoldability() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getResultSetType() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public int getUpdateCount() throws SQLException{ + // TODO Auto-generated method stub + return 0; + } + + + public SQLWarning getWarnings() throws SQLException{ + // TODO Auto-generated method stub + return null; + } + + + public boolean isClosed() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void setCursorName(String name) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setEscapeProcessing(boolean enable) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setFetchDirection(int direction) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setFetchSize(int rows) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setMaxFieldSize(int max) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setMaxRows(int max) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean isPoolable() throws SQLException{ + // TODO Auto-generated method stub + return false; + } + + + public void setPoolable(boolean poolable) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public void setQueryTimeout(int seconds) throws SQLException{ + // TODO Auto-generated method stub + + } + + + public boolean isWrapperFor(Class<?> iface){ + return iface.isAssignableFrom(this.getClass()); + } + + + public <T>T unwrap(Class<T> iface) throws SQLException{ + if(isWrapperFor(iface)){ + return (T)this; + } + throw new SQLException(this.getClass().getName() + " does not implements " + iface.getName() + ".", "01000"); + } + +} |