Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java29
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java158
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcDTResultSet.java81
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java336
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java58
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java210
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java61
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcUpdateableResultSet.java165
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java172
9 files changed, 867 insertions, 403 deletions
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java b/openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java
index 39ca89d7..81c92fc2 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcCallableStatement.java
@@ -31,8 +31,9 @@ import java.sql.*;
import java.util.Calendar;
import java.util.Map;
-import cli.System.Data.ParameterDirection;
+import cli.System.Data.*;
import cli.System.Data.Common.*;
+import cli.System.Data.Odbc.*;
@@ -43,8 +44,8 @@ public class JdbcOdbcCallableStatement extends JdbcOdbcPreparedStatement impleme
private final Parameters parameters = new Parameters();
- public JdbcOdbcCallableStatement(JdbcOdbcConnection jdbcConn, DbCommand command, String sql){
- super(jdbcConn, command, sql);
+ public JdbcOdbcCallableStatement(JdbcOdbcConnection jdbcConn, OdbcCommand command, String sql, int resultSetType, int resultSetConcurrency){
+ super(jdbcConn, command, sql, resultSetType, resultSetConcurrency);
}
@@ -349,11 +350,7 @@ public class JdbcOdbcCallableStatement extends JdbcOdbcPreparedStatement impleme
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException{
- DbParameter para = getPara(parameterIndex);
- int direction = para.get_Value() == null ? ParameterDirection.Output : ParameterDirection.InputOutput;
- para.set_Direction(ParameterDirection.wrap(direction));
- para.set_Size(1999); //TODO the value should depend of the type
- //TODO the type should be set
+ registerOutParameter(parameterIndex, sqlType, -1);
}
@@ -362,12 +359,22 @@ public class JdbcOdbcCallableStatement extends JdbcOdbcPreparedStatement impleme
}
- public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException{
+ public void registerOutParameter(int parameterIndex, int sqlType, int scaleOrLength) throws SQLException{
DbParameter para = getPara(parameterIndex);
int direction = para.get_Value() == null ? ParameterDirection.Output : ParameterDirection.InputOutput;
para.set_Direction(ParameterDirection.wrap(direction));
- para.set_Scale((byte)scale);
- //TODO see above
+
+ if(sqlType != Types.OTHER){
+ para.set_DbType(DbType.wrap(JdbcOdbcUtils.convertJdbc2AdoNetType(sqlType)));
+ }
+
+ if(scaleOrLength >= 0){
+ switch(sqlType){
+ case Types.DECIMAL:
+ case Types.NUMERIC:
+ para.set_Scale((byte)scaleOrLength);
+ }
+ }
}
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java b/openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java
index ed769505..1e0fb3a9 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcConnection.java
@@ -36,7 +36,7 @@ import java.util.Properties;
*/
public class JdbcOdbcConnection implements Connection{
- private final DbConnection netConn;
+ private final OdbcConnection netConn;
private DbTransaction transaction;
@@ -86,61 +86,52 @@ public class JdbcOdbcConnection implements Connection{
}
- public Array createArrayOf(String typeName, Object[] elements) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public Array createArrayOf(String typeName, Object[] elements){
+ throw new UnsupportedOperationException();
}
- public Blob createBlob() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public Blob createBlob(){
+ throw new UnsupportedOperationException();
}
- public Clob createClob() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public Clob createClob(){
+ throw new UnsupportedOperationException();
}
- public NClob createNClob() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public NClob createNClob(){
+ throw new UnsupportedOperationException();
}
- public SQLXML createSQLXML() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public SQLXML createSQLXML(){
+ throw new UnsupportedOperationException();
}
public Statement createStatement() throws SQLException{
- try{
- return new JdbcOdbcStatement(this, netConn.CreateCommand());
- }catch(Throwable ex){
- throw JdbcOdbcUtils.createSQLException(ex);
- }
+ return createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
}
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ return new JdbcOdbcStatement(this, netConn.CreateCommand(), resultSetType, resultSetConcurrency);
+ }catch(Throwable ex){
+ throw JdbcOdbcUtils.createSQLException(ex);
+ }
}
- public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
- throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability){
+ throw new UnsupportedOperationException();
}
- public Struct createStruct(String typeName, Object[] attributes) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public Struct createStruct(String typeName, Object[] attributes){
+ throw new UnsupportedOperationException();
}
@@ -224,33 +215,28 @@ public class JdbcOdbcConnection implements Connection{
}
- public String getClientInfo(String name) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public String getClientInfo(String name){
+ throw new UnsupportedOperationException();
}
- public Properties getClientInfo() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public Properties getClientInfo(){
+ throw new UnsupportedOperationException();
}
- public int getHoldability() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getHoldability(){
+ throw new UnsupportedOperationException();
}
- public DatabaseMetaData getMetaData() throws SQLException{
- // TODO Auto-generated method stub
- return new JdbcOdbcDatabaseMetaData(netConn);
+ public DatabaseMetaData getMetaData(){
+ return new JdbcOdbcDatabaseMetaData(this, netConn);
}
- public Map<String, Class<?>> getTypeMap() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public Map<String, Class<?>> getTypeMap(){
+ throw new UnsupportedOperationException();
}
@@ -272,81 +258,81 @@ public class JdbcOdbcConnection implements Connection{
public boolean isValid(int timeout) throws SQLException{
- // TODO Auto-generated method stub
- return true;
+ throw new UnsupportedOperationException();
}
public String nativeSQL(String sql) throws SQLException{
// TODO Auto-generated method stub
- return null;
+ return sql;
}
public CallableStatement prepareCall(String sql) throws SQLException{
- return new JdbcOdbcCallableStatement(this, netConn.CreateCommand(), sql);
+ return prepareCall(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
}
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ return new JdbcOdbcCallableStatement(this, netConn.CreateCommand(), sql, resultSetType,
+ resultSetConcurrency);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
- int resultSetHoldability) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ int resultSetHoldability){
+ throw new UnsupportedOperationException();
}
public PreparedStatement prepareStatement(String sql) throws SQLException{
- return new JdbcOdbcPreparedStatement(this, netConn.CreateCommand(), sql);
+ return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
}
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ return new JdbcOdbcPreparedStatement(this, netConn.CreateCommand(), sql, resultSetType,
+ resultSetConcurrency);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
- int resultSetHoldability) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ int resultSetHoldability){
+ throw new UnsupportedOperationException();
}
- public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys){
+ throw new UnsupportedOperationException();
}
- public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public PreparedStatement prepareStatement(String sql, int[] columnIndexes){
+ throw new UnsupportedOperationException();
}
- public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public PreparedStatement prepareStatement(String sql, String[] columnNames){
+ throw new UnsupportedOperationException();
}
- public void releaseSavepoint(Savepoint savepoint) throws SQLException{
- // TODO Auto-generated method stub
-
+ public void releaseSavepoint(Savepoint savepoint){
+ throw new UnsupportedOperationException();
}
- public void rollback(Savepoint savepoint) throws SQLException{
- // TODO Auto-generated method stub
-
+ public void rollback(Savepoint savepoint){
+ throw new UnsupportedOperationException();
}
@@ -359,26 +345,23 @@ public class JdbcOdbcConnection implements Connection{
}
- public String getCatalog() throws SQLException{
+ public String getCatalog(){
return netConn.get_Database();
}
- public void setClientInfo(String name, String value) throws SQLClientInfoException{
- // TODO Auto-generated method stub
-
+ public void setClientInfo(String name, String value){
+ throw new UnsupportedOperationException();
}
- public void setClientInfo(Properties properties) throws SQLClientInfoException{
- // TODO Auto-generated method stub
-
+ public void setClientInfo(Properties properties){
+ throw new UnsupportedOperationException();
}
- public void setHoldability(int holdability) throws SQLException{
- // TODO Auto-generated method stub
-
+ public void setHoldability(int holdability){
+ throw new UnsupportedOperationException();
}
@@ -398,9 +381,8 @@ public class JdbcOdbcConnection implements Connection{
}
- public void setTypeMap(Map<String, Class<?>> map) throws SQLException{
- // TODO Auto-generated method stub
-
+ public void setTypeMap(Map<String, Class<?>> map){
+ throw new UnsupportedOperationException();
}
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcDTResultSet.java b/openjdk/sun/jdbc/odbc/JdbcOdbcDTResultSet.java
index 13a253ab..9de750a4 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcDTResultSet.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcDTResultSet.java
@@ -28,8 +28,8 @@ import java.sql.*;
import cli.System.Data.*;
/**
- * This JDBC Driver is a wrapper to the ODBC.NET Data Provider. This ResultSet based on DataTable.
- * It is read only and scrollable.
+ * This JDBC Driver is a wrapper to the ODBC.NET Data Provider. This ResultSet based on DataTable. It is read only and
+ * scrollable.
*/
public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
@@ -43,7 +43,10 @@ public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
public JdbcOdbcDTResultSet(DataTable data){
- super(null, TYPE_SCROLL_INSENSITIVE, CONCUR_READ_ONLY);
+ this(data, CONCUR_READ_ONLY);
+ }
+ public JdbcOdbcDTResultSet(DataTable data, int concurrency){
+ super(null, TYPE_SCROLL_INSENSITIVE, concurrency);
this.data = data;
this.rows = data.get_Rows();
this.rowIndex = -1;
@@ -59,21 +62,21 @@ public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
int count = dataRows.get_Count();
if(rowPosition > 0){
if(rowPosition > count){
- row = null;
rowIndex = count;
+ setDataRow();
return false;
}
rowIndex = rowPosition - 1;
- row = dataRows.get_Item(rowIndex);
+ setDataRow();
return true;
}else{
if(-rowPosition > count){
- row = null;
rowIndex = -1;
+ setDataRow();
return false;
}
rowIndex = count + rowPosition;
- row = dataRows.get_Item(rowIndex);
+ setDataRow();
return true;
}
}
@@ -81,15 +84,15 @@ public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
@Override
public void afterLast() throws SQLException{
- row = null;
rowIndex = getRows().get_Count();
+ setDataRow();
}
@Override
- public void beforeFirst(){
- row = null;
+ public void beforeFirst() throws SQLException{
rowIndex = -1;
+ setDataRow();
}
@@ -171,11 +174,12 @@ public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
public boolean next() throws SQLException{
DataRowCollection dataRows = getRows();
if(rowIndex + 1 < dataRows.get_Count()){
- row = dataRows.get_Item(++rowIndex);
+ ++rowIndex;
+ setDataRow();
return true;
}else{
rowIndex = dataRows.get_Count();
- row = null;
+ setDataRow();
return false;
}
}
@@ -184,11 +188,12 @@ public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
@Override
public boolean previous() throws SQLException{
if(rowIndex > 0){
- row = getRows().get_Item(--rowIndex);
+ --rowIndex;
+ setDataRow();
return true;
}else{
rowIndex = -1;
- row = null;
+ setDataRow();
return false;
}
}
@@ -206,17 +211,17 @@ public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
int newRowIndex = rowIndex + rowPositions;
if(newRowIndex < 0){
rowIndex = -1;
- row = null;
+ setDataRow();
return false;
}
int count = dataRows.get_Count();
if(newRowIndex >= dataRows.get_Count()){
rowIndex = count;
- row = null;
+ setDataRow();
return false;
}
rowIndex = newRowIndex;
- row = getRows().get_Item(newRowIndex);
+ setDataRow();
return true;
}
@@ -226,14 +231,11 @@ public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
*/
@Override
protected Object getObjectImpl(int columnIndex) throws SQLException{
- getRows(); // checks if ResultSet is closed
- if(row == null){
- throw new SQLException("No current row", "S1109");
- }
try{
- return row.get_Item(columnIndex - 1);
+ return getDataRow().get_Item(columnIndex - 1);
}catch(ArrayIndexOutOfBoundsException ex){
- throw new SQLException( "Invalid column number ("+columnIndex+"). A number between 1 and "+data.get_Columns().get_Count()+" is valid.", "S1002");
+ throw new SQLException("Invalid column number (" + columnIndex + "). A number between 1 and "
+ + data.get_Columns().get_Count() + " is valid.", "S1002");
}
}
@@ -245,10 +247,41 @@ public class JdbcOdbcDTResultSet extends JdbcOdbcResultSet{
* @throws SQLException
* If the ResultSet is closed.
*/
- private DataRowCollection getRows() throws SQLException{
+ protected DataRowCollection getRows() throws SQLException{
if(rows == null){
throw new SQLException("ResultSet is closed.", "24000");
}
return rows;
}
+
+
+ /**
+ * Get the current DataRow
+ *
+ * @return the DataRow
+ * @throws SQLException
+ * if closed or no current Row
+ */
+ protected DataRow getDataRow() throws SQLException{
+ getRows(); // checks if ResultSet is closed
+ if(row == null){
+ throw new SQLException("No current row", "S1109");
+ }
+ return row;
+ }
+
+ /**
+ * Set the current row from the current rowIndex. If the rowIndex was not change
+ * then the row variable will be new set.
+ * @throws SQLException If the ResultSet is closed.
+ */
+ protected void setDataRow() throws SQLException{
+ DataRowCollection dataRows = getRows();
+ if(rowIndex < 0 || rowIndex >= dataRows.get_Count()){
+ row = null;
+ }else{
+ row = dataRows.get_Item(rowIndex);
+ }
+ }
+
}
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java b/openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java
index 24a106e6..7550b965 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java
@@ -23,11 +23,10 @@
*/
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 ikvm.lang.CIL;
+
+import java.sql.*;
+import java.util.HashSet;
import cli.System.Data.*;
import cli.System.Data.Common.*;
@@ -38,10 +37,14 @@ import cli.System.Data.Odbc.*;
*/
public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
- private final DbConnection netConn;
+ private JdbcOdbcConnection jdbcConn;
+
+ private final OdbcConnection netConn;
+ private DataRow dataSourceInfo;
- public JdbcOdbcDatabaseMetaData(DbConnection netConn){
+ public JdbcOdbcDatabaseMetaData(JdbcOdbcConnection jdbcConn, OdbcConnection netConn){
+ this.jdbcConn = jdbcConn;
this.netConn = netConn;
}
@@ -58,9 +61,8 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public boolean autoCommitFailureClosesAllResultSets() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ public boolean autoCommitFailureClosesAllResultSets(){
+ throw new UnsupportedOperationException();
}
@@ -89,9 +91,8 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern,
- String attributeNamePattern) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ String attributeNamePattern){
+ throw new UnsupportedOperationException();
}
@@ -120,9 +121,8 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public ResultSet getClientInfoProperties() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public ResultSet getClientInfoProperties(){
+ throw new UnsupportedOperationException();
}
@@ -135,14 +135,19 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ // the description of the restrictions can you request with GetSchema("Restrictions")
+ String[] restrictions = new String[]{catalog, schemaPattern, tableNamePattern, columnNamePattern};
+ DataTable data = netConn.GetSchema(OdbcMetaDataCollectionNames.Columns, restrictions);
+ return new JdbcOdbcDTResultSet(data);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
- public Connection getConnection() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public Connection getConnection(){
+ return jdbcConn;
}
@@ -153,57 +158,67 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public int getDatabaseMajorVersion() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getDatabaseMajorVersion(){
+ String version = netConn.get_ServerVersion().trim();
+ for(int i = 0; i < version.length(); i++){
+ char ch = version.charAt(i);
+ if(ch < '0' || ch > '9'){
+ return Integer.parseInt(version.substring(0, i));
+ }
+ }
+ return Integer.parseInt(version);
}
- public int getDatabaseMinorVersion() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getDatabaseMinorVersion(){
+ String version = netConn.get_ServerVersion().trim();
+ int idx = version.indexOf('.');
+ if(idx < 0){
+ return 0;
+ }
+ version = version.substring(idx + 1);
+ for(int i = 0; i < version.length(); i++){
+ char ch = version.charAt(i);
+ if(ch < '0' || ch > '9'){
+ return Integer.parseInt(version.substring(0, i));
+ }
+ }
+ return Integer.parseInt(version);
}
public String getDatabaseProductName() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ return String.valueOf(getInfo(DbMetaDataColumnNames.DataSourceProductName));
}
- public String getDatabaseProductVersion() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public String getDatabaseProductVersion(){
+ return netConn.get_ServerVersion();
}
- public int getDefaultTransactionIsolation() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getDefaultTransactionIsolation(){
+ return Connection.TRANSACTION_READ_COMMITTED;
}
public int getDriverMajorVersion(){
- // TODO Auto-generated method stub
- return 0;
+ return 2;
}
public int getDriverMinorVersion(){
- // TODO Auto-generated method stub
- return 0;
+ return 1;
}
- public String getDriverName() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public String getDriverName(){
+ return "JDBC-ODBC Bridge (" + netConn.get_Driver() + ")";
}
- public String getDriverVersion() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public String getDriverVersion(){
+ return "2.0001";
}
@@ -213,28 +228,32 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public String getExtraNameCharacters() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public String getExtraNameCharacters(){
+ return "";
}
public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern,
- String columnNamePattern) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ String columnNamePattern){
+ throw new UnsupportedOperationException();
}
- public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern){
+ throw new UnsupportedOperationException();
}
public String getIdentifierQuoteString() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ String quote = (String)getInfo(DbMetaDataColumnNames.QuotedIdentifierPattern);
+ if(quote.length()>=2){
+ char ch1 = quote.charAt(0);
+ char ch2 = quote.charAt(quote.length()-1);
+ if(ch1 == ch2){
+ return quote.substring(0,1);
+ }
+ }
+ return "\""; // ANSI SQL and should work with the most DBMS
}
@@ -246,19 +265,23 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate)
throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ // the description of the restrictions can you request with GetSchema("Restrictions")
+ String[] restrictions = new String[]{catalog, schema, table};
+ DataTable data = netConn.GetSchema(OdbcMetaDataCollectionNames.Indexes, restrictions);
+ return new JdbcOdbcDTResultSet(data);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
- public int getJDBCMajorVersion() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getJDBCMajorVersion(){
+ return 2;
}
- public int getJDBCMinorVersion() throws SQLException{
- // TODO Auto-generated method stub
+ public int getJDBCMinorVersion(){
return 0;
}
@@ -397,8 +420,22 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern,
String columnNamePattern) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ // the description of the restrictions can you request with GetSchema("Restrictions")
+ String[] restrictions = new String[]{catalog, schemaPattern, procedureNamePattern, columnNamePattern};
+ DataTable dt1 = netConn.GetSchema(OdbcMetaDataCollectionNames.ProcedureColumns, restrictions);
+ DataTable dt2 = netConn.GetSchema(OdbcMetaDataCollectionNames.ProcedureParameters, restrictions);
+ // concatenate the both DataTable
+ DataRowCollection rows1 = dt1.get_Rows();
+ DataRowCollection rows2 = dt2.get_Rows();
+ for(int i = 0; i < rows2.get_Count(); i++){
+ DataRow row = rows2.get_Item(i);
+ rows1.Add(row.get_ItemArray());
+ }
+ return new JdbcOdbcDTResultSet(dt1);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
@@ -410,28 +447,44 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
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 JdbcOdbcDTResultSet(data);
+ try{
+ // 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 JdbcOdbcDTResultSet(data);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
- public int getResultSetHoldability() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getResultSetHoldability(){
+ throw new UnsupportedOperationException();
}
- public RowIdLifetime getRowIdLifetime() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public RowIdLifetime getRowIdLifetime(){
+ throw new UnsupportedOperationException();
}
public String getSQLKeywords() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ DataTable dt = netConn.GetSchema(DbMetaDataCollectionNames.ReservedWords);
+ final DataRowCollection rows = dt.get_Rows();
+ final int count = rows.get_Count();
+ final StringBuilder builder = new StringBuilder();
+ for(int i=0; i<count; i++){
+ String word = (String)rows.get_Item(i).get_Item(0);
+ if(builder.length() > 0){
+ builder.append(',');
+ }
+ builder.append(word);
+ }
+ return builder.toString();
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
@@ -453,9 +506,8 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public ResultSet getSchemas(String catalog, String schemaPattern){
+ throw new UnsupportedOperationException();
}
@@ -471,15 +523,13 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern){
+ throw new UnsupportedOperationException();
}
- public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern){
+ throw new UnsupportedOperationException();
}
@@ -504,8 +554,36 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ // the description of the restrictions can you request with GetSchema("Restrictions")
+ String[] restrictions = new String[]{catalog, schemaPattern, tableNamePattern};
+ DataTable dt1 = netConn.GetSchema(OdbcMetaDataCollectionNames.Tables, restrictions);
+ DataTable dt2 = netConn.GetSchema(OdbcMetaDataCollectionNames.Views, restrictions);
+ // concatenate the both DataTable
+ DataRowCollection rows1 = dt1.get_Rows();
+ DataRowCollection rows2 = dt2.get_Rows();
+ for(int i = 0; i < rows2.get_Count(); i++){
+ DataRow row = rows2.get_Item(i);
+ rows1.Add(row.get_ItemArray());
+ }
+ if(types != null){
+ RowLoop:
+ // Filter the types
+ for(int i = rows1.get_Count() - 1; i >= 0; i--){
+ DataRow row = rows1.get_Item(i);
+ Object tableType = row.get_Item("TABLE_TYPE");
+ for(String type : types){
+ if(type.equals(tableType)){
+ continue RowLoop;
+ }
+ }
+ rows1.RemoveAt(i);
+ }
+ }
+ return new JdbcOdbcDTResultSet(dt1);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
@@ -516,15 +594,18 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public ResultSet getTypeInfo() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ try{
+ //TODO Column Names and order are wrong
+ DataTable data = netConn.GetSchema(DbMetaDataCollectionNames.DataTypes);
+ return new JdbcOdbcDTResultSet(data);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
}
- public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types)
- throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types){
+ throw new UnsupportedOperationException();
}
@@ -564,9 +645,8 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public boolean locatorsUpdateCopy() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ public boolean locatorsUpdateCopy(){
+ throw new UnsupportedOperationException();
}
@@ -799,8 +879,8 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public boolean supportsFullOuterJoins() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ int join = CIL.unbox_int(getInfo(DbMetaDataColumnNames.SupportedJoinOperators));
+ return (join & SupportedJoinOperators.FullOuter) > 0;
}
@@ -811,20 +891,20 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public boolean supportsGroupBy() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ int behavior = CIL.unbox_int(getInfo(DbMetaDataColumnNames.GroupByBehavior));
+ return behavior != GroupByBehavior.NotSupported;
}
public boolean supportsGroupByBeyondSelect() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ int behavior = CIL.unbox_int(getInfo(DbMetaDataColumnNames.GroupByBehavior));
+ return behavior == GroupByBehavior.MustContainAll;
}
public boolean supportsGroupByUnrelated() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ int behavior = CIL.unbox_int(getInfo(DbMetaDataColumnNames.GroupByBehavior));
+ return behavior == GroupByBehavior.Unrelated;
}
@@ -835,14 +915,13 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public boolean supportsLikeEscapeClause() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ return getSQLKeywords().toUpperCase().indexOf(",LIKE,") > 0;
}
public boolean supportsLimitedOuterJoins() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ int join = CIL.unbox_int(getInfo(DbMetaDataColumnNames.SupportedJoinOperators));
+ return join > 0;
}
@@ -853,14 +932,14 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public boolean supportsMixedCaseIdentifiers() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ int identifierCase = CIL.unbox_int(getInfo(DbMetaDataColumnNames.IdentifierCase));
+ return identifierCase == IdentifierCase.Sensitive;
}
public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ int identifierCase = CIL.unbox_int(getInfo(DbMetaDataColumnNames.QuotedIdentifierCase));
+ return identifierCase == IdentifierCase.Sensitive;
}
@@ -919,14 +998,13 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
public boolean supportsOrderByUnrelated() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ return CIL.unbox_boolean( getInfo(DbMetaDataColumnNames.OrderByColumnsInSelect));
}
public boolean supportsOuterJoins() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ int join = CIL.unbox_int(getInfo(DbMetaDataColumnNames.SupportedJoinOperators));
+ return (join & SupportedJoinOperators.LeftOuter) > 0 || (join & SupportedJoinOperators.RightOuter) > 0;
}
@@ -948,9 +1026,8 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public boolean supportsResultSetHoldability(int holdability) throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ public boolean supportsResultSetHoldability(int holdability){
+ throw new UnsupportedOperationException();
}
@@ -1002,15 +1079,13 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
}
- public boolean supportsStatementPooling() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ public boolean supportsStatementPooling(){
+ throw new UnsupportedOperationException();
}
public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException{
- // TODO Auto-generated method stub
- return false;
+ throw new UnsupportedOperationException();
}
@@ -1104,4 +1179,15 @@ public class JdbcOdbcDatabaseMetaData implements DatabaseMetaData{
throw new SQLException(this.getClass().getName() + " does not implements " + iface.getName() + ".", "01000");
}
+ private Object getInfo(String key) throws SQLException{
+ try{
+ if(dataSourceInfo == null){
+ DataTable td = netConn.GetSchema(DbMetaDataCollectionNames.DataSourceInformation);
+ dataSourceInfo = td.get_Rows().get_Item(0);
+ }
+ return dataSourceInfo.get_Item(key);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
+ }
}
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java b/openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java
index 26d96426..93805fd6 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcPreparedStatement.java
@@ -45,19 +45,17 @@ import java.sql.Timestamp;
import java.sql.Types;
import java.util.Calendar;
-import cli.System.DBNull;
-import cli.System.Data.ParameterDirection;
-import cli.System.Data.Common.DbCommand;
-import cli.System.Data.Common.DbParameter;
-import cli.System.Data.Common.DbParameterCollection;
+import cli.System.Data.*;
+import cli.System.Data.Common.*;
+import cli.System.Data.Odbc.*;
/**
* @author Volker Berlin
*/
public class JdbcOdbcPreparedStatement extends JdbcOdbcStatement implements PreparedStatement{
- public JdbcOdbcPreparedStatement(JdbcOdbcConnection jdbcConn, DbCommand command, String sql){
- super(jdbcConn, command);
+ public JdbcOdbcPreparedStatement(JdbcOdbcConnection jdbcConn, OdbcCommand command, String sql, int resultSetType, int resultSetConcurrency){
+ super(jdbcConn, command, resultSetType, resultSetConcurrency);
command.set_CommandText(sql);
command.Prepare();
}
@@ -69,9 +67,9 @@ public class JdbcOdbcPreparedStatement extends JdbcOdbcStatement implements Prep
}
- public void clearParameters() throws SQLException{
- // TODO Auto-generated method stub
-
+ public void clearParameters(){
+ DbParameterCollection params = command.get_Parameters();
+ params.Clear();
}
@@ -91,12 +89,18 @@ public class JdbcOdbcPreparedStatement extends JdbcOdbcStatement implements Prep
public ResultSetMetaData getMetaData() throws SQLException{
- // TODO Auto-generated method stub
- return null;
+ ResultSet rs = getResultSet();
+ if(rs != null){
+ rs.getMetaData();
+ }
+ DbDataReader reader = command.ExecuteReader(CommandBehavior.wrap(CommandBehavior.SchemaOnly));
+ JdbcOdbcResultSetMetaData metadata = new JdbcOdbcResultSetMetaData(reader);
+ reader.Close();
+ return metadata;
}
- public ParameterMetaData getParameterMetaData() throws SQLException{
+ public ParameterMetaData getParameterMetaData(){
throw new UnsupportedOperationException();
}
@@ -273,23 +277,33 @@ public class JdbcOdbcPreparedStatement extends JdbcOdbcStatement implements Prep
public void setObject(int parameterIndex, Object x) throws SQLException{
- DbParameter para = getPara(parameterIndex);
- para.set_Value(x == null ? DBNull.Value : x);
- if(para.get_Direction().Value == ParameterDirection.Output){
- para.set_Direction(ParameterDirection.wrap(ParameterDirection.InputOutput));
- }
+ setObject(parameterIndex, x, Types.OTHER, -1);
}
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException{
- // TODO Auto-generated method stub
- setObject(parameterIndex, x);
+ setObject(parameterIndex, x, targetSqlType, -1);
}
public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException{
- // TODO Auto-generated method stub
- setObject(parameterIndex, x);
+ DbParameter para = getPara(parameterIndex);
+ para.set_Value(JdbcOdbcUtils.convertJava2Net(x, scaleOrLength));
+ if(para.get_Direction().Value == ParameterDirection.Output){
+ para.set_Direction(ParameterDirection.wrap(ParameterDirection.InputOutput));
+ }
+
+ if(targetSqlType != Types.OTHER){
+ para.set_DbType(DbType.wrap(JdbcOdbcUtils.convertJdbc2AdoNetType(targetSqlType)));
+ }
+
+ if(scaleOrLength >= 0){
+ switch(targetSqlType){
+ case Types.DECIMAL:
+ case Types.NUMERIC:
+ para.set_Scale((byte)scaleOrLength);
+ }
+ }
}
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java b/openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java
index 2db8cf22..7b4c91b6 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java
@@ -311,322 +311,322 @@ public class JdbcOdbcResultSet extends JdbcOdbcObject implements ResultSet{
public void updateArray(int columnIndex, Array x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateArray(String columnLabel, Array x) throws SQLException{
- throwReadOnly();
+ updateArray(findColumn(columnLabel), x);
}
public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x, length);
}
public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x, length);
}
public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x, (int)length);
}
public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x, (int)length);
}
public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x, length);
}
public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x, length);
}
public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x, (int)length);
}
public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x, (int)length);
}
public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
public void updateBlob(int columnIndex, Blob x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateBlob(String columnLabel, Blob x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
- public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException{
- throwReadOnly();
+ public void updateBlob(int columnIndex, InputStream x, long length) throws SQLException{
+ updateObject(columnIndex, x, (int)length);
}
- public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException{
- throwReadOnly();
+ public void updateBlob(String columnLabel, InputStream x, long length) throws SQLException{
+ updateObject(findColumn(columnLabel), x, (int)length);
}
- public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException{
- throwReadOnly();
+ public void updateBlob(int columnIndex, InputStream x) throws SQLException{
+ updateObject(columnIndex, x);
}
- public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException{
- throwReadOnly();
+ public void updateBlob(String columnLabel, InputStream x) throws SQLException{
+ updateObject(findColumn(columnLabel), x);
}
public void updateBoolean(int columnIndex, boolean x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, Boolean.valueOf(x));
}
public void updateBoolean(String columnLabel, boolean x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), Boolean.valueOf(x));
}
public void updateByte(int columnIndex, byte x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, Byte.valueOf(x));
}
public void updateByte(String columnLabel, byte x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), Byte.valueOf(x));
}
public void updateBytes(int columnIndex, byte[] x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateBytes(String columnLabel, byte[] x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x, length);
}
- public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException{
- throwReadOnly();
+ public void updateCharacterStream(String columnLabel, Reader x, int length) throws SQLException{
+ updateObject(findColumn(columnLabel), x, length);
}
public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x, (int)length);
}
- public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException{
- throwReadOnly();
+ public void updateCharacterStream(String columnLabel, Reader x, long length) throws SQLException{
+ updateObject(findColumn(columnLabel), x, (int)length);
}
public void updateCharacterStream(int columnIndex, Reader x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
- public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException{
- throwReadOnly();
+ public void updateCharacterStream(String columnLabel, Reader x) throws SQLException{
+ updateObject(findColumn(columnLabel), x);
}
public void updateClob(int columnIndex, Clob x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateClob(String columnLabel, Clob x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
- public void updateClob(int columnIndex, Reader reader, long length) throws SQLException{
- throwReadOnly();
+ public void updateClob(int columnIndex, Reader x, long length) throws SQLException{
+ updateObject(columnIndex, x, (int)length);
}
- public void updateClob(String columnLabel, Reader reader, long length) throws SQLException{
- throwReadOnly();
+ public void updateClob(String columnLabel, Reader x, long length) throws SQLException{
+ updateObject(findColumn(columnLabel), x, (int)length);
}
- public void updateClob(int columnIndex, Reader reader) throws SQLException{
- throwReadOnly();
+ public void updateClob(int columnIndex, Reader x) throws SQLException{
+ updateObject(columnIndex, x);
}
- public void updateClob(String columnLabel, Reader reader) throws SQLException{
- throwReadOnly();
+ public void updateClob(String columnLabel, Reader x) throws SQLException{
+ updateObject(findColumn(columnLabel), x);
}
public void updateDate(int columnIndex, Date x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateDate(String columnLabel, Date x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
public void updateDouble(int columnIndex, double x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, Double.valueOf(x));
}
public void updateDouble(String columnLabel, double x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), Double.valueOf(x));
}
public void updateFloat(int columnIndex, float x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, Float.valueOf(x));
}
public void updateFloat(String columnLabel, float x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), Float.valueOf(x));
}
public void updateInt(int columnIndex, int x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, Integer.valueOf(x));
}
public void updateInt(String columnLabel, int x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), Integer.valueOf(x));
}
public void updateLong(int columnIndex, long x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, Long.valueOf(x));
}
public void updateLong(String columnLabel, long x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), Long.valueOf(x));
}
public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x, (int)length);
}
- public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException{
- throwReadOnly();
+ public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException{
+ updateObject(findColumn(columnLabel), x, (int)length);
}
public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
- public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException{
- throwReadOnly();
+ public void updateNCharacterStream(String columnLabel, Reader x) throws SQLException{
+ updateObject(findColumn(columnLabel), x);
}
- public void updateNClob(int columnIndex, NClob clob) throws SQLException{
- throwReadOnly();
+ public void updateNClob(int columnIndex, NClob x) throws SQLException{
+ updateObject(columnIndex, x);
}
- public void updateNClob(String columnLabel, NClob clob) throws SQLException{
- throwReadOnly();
+ public void updateNClob(String columnLabel, NClob x) throws SQLException{
+ updateObject(findColumn(columnLabel), x);
}
- public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException{
- throwReadOnly();
+ public void updateNClob(int columnIndex, Reader x, long length) throws SQLException{
+ updateObject(columnIndex, x, (int)length);
}
- public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException{
- throwReadOnly();
+ public void updateNClob(String columnLabel, Reader x, long length) throws SQLException{
+ updateObject(findColumn(columnLabel), x, (int)length);
}
- public void updateNClob(int columnIndex, Reader reader) throws SQLException{
- throwReadOnly();
+ public void updateNClob(int columnIndex, Reader x) throws SQLException{
+ updateObject(columnIndex, x);
}
- public void updateNClob(String columnLabel, Reader reader) throws SQLException{
- throwReadOnly();
+ public void updateNClob(String columnLabel, Reader x) throws SQLException{
+ updateObject(findColumn(columnLabel), x);
}
- public void updateNString(int columnIndex, String string) throws SQLException{
- throwReadOnly();
+ public void updateNString(int columnIndex, String x) throws SQLException{
+ updateObject(columnIndex, x);
}
- public void updateNString(String columnLabel, String string) throws SQLException{
- throwReadOnly();
+ public void updateNString(String columnLabel, String x) throws SQLException{
+ updateObject(findColumn(columnLabel), x);
}
public void updateNull(int columnIndex) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, null);
}
public void updateNull(String columnLabel) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), null);
}
@@ -636,27 +636,27 @@ public class JdbcOdbcResultSet extends JdbcOdbcObject implements ResultSet{
public void updateObject(int columnIndex, Object x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x, -1);
}
public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x, scaleOrLength);
}
public void updateObject(String columnLabel, Object x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
public void updateRef(int columnIndex, Ref x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateRef(String columnLabel, Ref x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
@@ -666,62 +666,62 @@ public class JdbcOdbcResultSet extends JdbcOdbcObject implements ResultSet{
public void updateRowId(int columnIndex, RowId x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateRowId(String columnLabel, RowId x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
- public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException{
- throwReadOnly();
+ public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException{
+ updateObject(columnIndex, x);
}
- public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException{
- throwReadOnly();
+ public void updateSQLXML(String columnLabel, SQLXML x) throws SQLException{
+ updateObject(findColumn(columnLabel), x);
}
public void updateShort(int columnIndex, short x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, Short.valueOf(x));
}
public void updateShort(String columnLabel, short x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), Short.valueOf(x));
}
public void updateString(int columnIndex, String x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateString(String columnLabel, String x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
public void updateTime(int columnIndex, Time x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateTime(String columnLabel, Time x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException{
- throwReadOnly();
+ updateObject(columnIndex, x);
}
public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException{
- throwReadOnly();
+ updateObject(findColumn(columnLabel), x);
}
@@ -772,7 +772,7 @@ public class JdbcOdbcResultSet extends JdbcOdbcObject implements ResultSet{
try{
return datareader.get_Item(columnIndex-1);
}catch(ArrayIndexOutOfBoundsException aioobe){
- throw new SQLException( "Invalid column number ("+columnIndex+"). A number between 1 and "+datareader.get_FieldCount()+" is valid.", "S1002");
+ throw new SQLException( "Invalid column number ("+columnIndex+"). A number between 1 and "+datareader.get_FieldCount()+" is valid.", "S1002", aioobe);
}
}catch(Throwable ex){
throw JdbcOdbcUtils.createSQLException(ex);
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java b/openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java
index 1dcce738..76123b34 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcStatement.java
@@ -25,7 +25,9 @@ package sun.jdbc.odbc;
import java.sql.*;
+import cli.System.Data.*;
import cli.System.Data.Common.*;
+import cli.System.Data.Odbc.*;
/**
* This JDBC Driver is a wrapper to the ODBC.NET Data Provider.
@@ -34,8 +36,12 @@ public class JdbcOdbcStatement implements Statement{
private final JdbcOdbcConnection jdbcConn;
- protected final DbCommand command;
+ protected final OdbcCommand command;
+ private final int resultSetType;
+
+ private final int resultSetConcurrency;
+
private DbDataReader reader;
private ResultSet rs;
@@ -46,9 +52,11 @@ public class JdbcOdbcStatement implements Statement{
private ResultSet moreResults;
- public JdbcOdbcStatement(JdbcOdbcConnection jdbcConn, DbCommand command){
+ public JdbcOdbcStatement(JdbcOdbcConnection jdbcConn, OdbcCommand command, int resultSetType, int resultSetConcurrency){
this.jdbcConn = jdbcConn;
this.command = command;
+ this.resultSetType = resultSetType;
+ this.resultSetConcurrency = resultSetConcurrency;
}
@@ -130,8 +138,19 @@ public class JdbcOdbcStatement implements Statement{
if(sql != null){
command.set_CommandText(sql);
}
- reader = command.ExecuteReader();
- rs = new JdbcOdbcResultSet(this, reader);
+ if(resultSetConcurrency == ResultSet.CONCUR_UPDATABLE){
+ rs = new JdbcOdbcUpdateableResultSet(command);
+ }else{
+ if(resultSetType == ResultSet.TYPE_FORWARD_ONLY){
+ reader = command.ExecuteReader();
+ rs = new JdbcOdbcResultSet(this, reader);
+ }else{
+ OdbcDataAdapter da = new OdbcDataAdapter(command);
+ DataTable dt = new DataTable();
+ da.Fill(dt);
+ rs = new JdbcOdbcDTResultSet(dt);
+ }
+ }
return rs;
}catch(Throwable ex){
throw JdbcOdbcUtils.createSQLException(ex);
@@ -172,14 +191,12 @@ public class JdbcOdbcStatement implements Statement{
}
- public int getFetchDirection() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getFetchDirection(){
+ return ResultSet.FETCH_UNKNOWN;
}
- public int getFetchSize() throws SQLException{
- // TODO Auto-generated method stub
+ public int getFetchSize(){
return 0;
}
@@ -237,9 +254,8 @@ public class JdbcOdbcStatement implements Statement{
}
- public int getResultSetConcurrency() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getResultSetConcurrency(){
+ return resultSetConcurrency;
}
@@ -249,9 +265,8 @@ public class JdbcOdbcStatement implements Statement{
}
- public int getResultSetType() throws SQLException{
- // TODO Auto-generated method stub
- return 0;
+ public int getResultSetType(){
+ return resultSetType;
}
@@ -283,15 +298,13 @@ public class JdbcOdbcStatement implements Statement{
}
- public void setFetchDirection(int direction) throws SQLException{
- // TODO Auto-generated method stub
-
+ public void setFetchDirection(int direction){
+ // ignore it
}
- public void setFetchSize(int rows) throws SQLException{
- // TODO Auto-generated method stub
-
+ public void setFetchSize(int rows){
+ // ignore it
}
@@ -307,15 +320,13 @@ public class JdbcOdbcStatement implements Statement{
}
- public boolean isPoolable() throws SQLException{
- // TODO Auto-generated method stub
+ public boolean isPoolable(){
return false;
}
public void setPoolable(boolean poolable) throws SQLException{
- // TODO Auto-generated method stub
-
+ // ignore it
}
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcUpdateableResultSet.java b/openjdk/sun/jdbc/odbc/JdbcOdbcUpdateableResultSet.java
new file mode 100644
index 00000000..a3ce0ffe
--- /dev/null
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcUpdateableResultSet.java
@@ -0,0 +1,165 @@
+/*
+ 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.Odbc.*;
+
+/**
+ * @author Volker Berlin
+ */
+public class JdbcOdbcUpdateableResultSet extends JdbcOdbcDTResultSet{
+
+ private final OdbcDataAdapter da;
+
+ private final DataTable data;
+
+ private DataRow insertRow;
+
+
+ public JdbcOdbcUpdateableResultSet(OdbcCommand cmd){
+ this(new DataTable(), cmd);
+ }
+
+
+ private JdbcOdbcUpdateableResultSet(DataTable data, OdbcCommand cmd){
+ super(data, CONCUR_UPDATABLE);
+ this.data = data;
+ da = new OdbcDataAdapter(cmd);
+ da.Fill(data);
+ OdbcCommandBuilder cmdBldr = new OdbcCommandBuilder(da);
+ cmdBldr.GetUpdateCommand(); // throw an exception if update is not possible, we want a very early exception
+ }
+
+
+ @Override
+ protected DataRow getDataRow() throws SQLException{
+ if(insertRow != null){
+ return insertRow;
+ }
+ return super.getDataRow();
+ }
+
+
+ @Override
+ protected void setDataRow() throws SQLException{
+ insertRow = null;
+ super.setDataRow();
+ }
+
+
+ @Override
+ public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException{
+ try{
+ x = JdbcOdbcUtils.convertJava2Net(x, scaleOrLength);
+ getDataRow().set_Item(columnIndex - 1, x);
+ }catch(ArrayIndexOutOfBoundsException ex){
+ throw new SQLException("Invalid column number (" + columnIndex + "). A number between 1 and "
+ + data.get_Columns().get_Count() + " is valid.", "S1002", ex);
+ }
+ }
+
+
+ @Override
+ public void updateRow() throws SQLException{
+ if(insertRow != null){
+ throw new SQLException("Cursor is on the insert row.");
+ }
+ try{
+ da.Update(data);
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
+ }
+
+
+ @Override
+ public void deleteRow() throws SQLException{
+ if(insertRow != null){
+ throw new SQLException("Cursor is on the insert row.");
+ }
+ try{
+ getDataRow().Delete(); // Delete the current row
+ da.Update(data);
+ setDataRow(); // set a new Current Row
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
+ }
+
+
+ @Override
+ public void insertRow() throws SQLException{
+ if(insertRow == null){
+ throw new SQLException("Cursor is not on the insert row.");
+ }
+ try{
+ getRows().Add(insertRow);
+ insertRow = null;
+ da.Update(data);
+ last();
+ }catch(Throwable th){
+ throw JdbcOdbcUtils.createSQLException(th);
+ }
+
+ }
+
+
+ @Override
+ public void moveToInsertRow(){
+ insertRow = data.NewRow();
+ }
+
+
+ @Override
+ public void moveToCurrentRow(){
+ insertRow = null;
+ }
+
+
+ @Override
+ public void cancelRowUpdates() throws SQLException{
+ getDataRow().CancelEdit();
+ }
+
+
+ @Override
+ public boolean rowDeleted(){
+ return false;
+ }
+
+
+ @Override
+ public boolean rowInserted(){
+ return false;
+ }
+
+
+ @Override
+ public boolean rowUpdated(){
+ return false;
+ }
+}
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java b/openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java
index 8ef74913..54d349ec 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java
@@ -30,6 +30,9 @@ import java.sql.*;
import java.util.Calendar;
import java.util.HashMap;
+import cli.System.DBNull;
+import cli.System.TimeSpan;
+import cli.System.Data.DbType;
import cli.System.Data.Common.DbException;
import cli.System.Data.Odbc.*;
@@ -76,6 +79,9 @@ public class JdbcOdbcUtils{
* @return a Java Object
*/
public static java.lang.Object convertNet2Java(java.lang.Object obj){
+ if(obj instanceof cli.System.Int64){
+ return Long.valueOf(CIL.unbox_long(obj));
+ }
if(obj instanceof cli.System.Int32){
return Integer.valueOf(CIL.unbox_int(obj));
}
@@ -85,6 +91,15 @@ public class JdbcOdbcUtils{
if(obj instanceof cli.System.Byte){
return Byte.valueOf(CIL.unbox_byte(obj));
}
+ if(obj instanceof cli.System.Double){
+ return Double.valueOf(CIL.unbox_double(obj));
+ }
+ if(obj instanceof cli.System.Single){
+ return Float.valueOf(CIL.unbox_float(obj));
+ }
+ if(obj instanceof cli.System.Boolean){
+ return Boolean.valueOf(CIL.unbox_boolean(obj));
+ }
if(obj instanceof cli.System.Decimal){
return new BigDecimal(((cli.System.Decimal)obj).toString());
}
@@ -93,7 +108,72 @@ public class JdbcOdbcUtils{
}
if(obj instanceof cli.System.TimeSpan){
cli.System.TimeSpan ts = (cli.System.TimeSpan)obj;
- return new Time(ts.get_Hours(), ts.get_Minutes() - 1, ts.get_Seconds());
+ return new Time(ts.get_Hours(), ts.get_Minutes(), ts.get_Seconds());
+ }
+ if(obj instanceof cli.System.DBNull){
+ return null;
+ }
+ return obj;
+ }
+
+
+ /**
+ * Convert a Java Object in the equals .NET Object.
+ *
+ * @param obj
+ * Java Object
+ * @param length
+ * the length of data if obj is a stream
+ * @return .NET Object
+ */
+ public static Object convertJava2Net(Object obj, int length){
+ // TODO use the length with streams
+ return convertJava2Net(obj);
+ }
+
+
+ /**
+ * Convert a Java Object in the equals .NET Object.
+ *
+ * @param obj
+ * Java Object
+ * @return a .NET Object
+ */
+ public static Object convertJava2Net(Object obj){
+ if(obj == null){
+ return DBNull.Value;
+ }
+ if(obj instanceof Double){
+ return CIL.box_double(((Double)obj).doubleValue());
+ }
+ if(obj instanceof Float){
+ return CIL.box_float(((Float)obj).floatValue());
+ }
+ if(obj instanceof Long){
+ return CIL.box_long(((Long)obj).longValue());
+ }
+ if(obj instanceof Integer){
+ return CIL.box_int(((Integer)obj).intValue());
+ }
+ if(obj instanceof Short){
+ return CIL.box_short(((Short)obj).shortValue());
+ }
+ if(obj instanceof Byte){
+ return CIL.box_byte(((Byte)obj).byteValue());
+ }
+ if(obj instanceof Boolean){
+ return CIL.box_boolean(((Boolean)obj).booleanValue());
+ }
+ if(obj instanceof Time){
+ Time ts = (Time)obj;
+ return new TimeSpan(ts.getHours(), ts.getMinutes(), ts.getSeconds());
+ }
+ if(obj instanceof java.util.Date){
+ long ticks = getNetTicks((java.util.Date)obj);
+ return new cli.System.DateTime(ticks);
+ }
+ if(obj instanceof BigDecimal){
+ return cli.System.Decimal.Parse(obj.toString());
}
return obj;
}
@@ -114,6 +194,20 @@ public class JdbcOdbcUtils{
/**
+ * Get the ticks for a System.DateTime from a java.util.Date
+ *
+ * @param date
+ * the java.util.Date
+ * @return ticks
+ */
+ public static long getNetTicks(java.util.Date date){
+ // inverse from getJavaMillis
+ long january_1st_1970 = 62135596800000L;
+ return (date.getTime() + january_1st_1970) * 10000L;
+ }
+
+
+ /**
* Convert a local (current default) Date to a Date in the time zone of the given calendar. Do nothing if date or
* calendar is null.
*
@@ -145,13 +239,13 @@ public class JdbcOdbcUtils{
return;
}
cal.setTimeInMillis(date.getTime());
- date.setYear(cal.get(Calendar.YEAR)-1900);
+ date.setYear(cal.get(Calendar.YEAR) - 1900);
date.setMonth(cal.get(Calendar.MONTH));
date.setDate(cal.get(Calendar.DAY_OF_MONTH));
date.setHours(cal.get(Calendar.HOUR_OF_DAY));
date.setMinutes(cal.get(Calendar.MINUTE));
date.setSeconds(cal.get(Calendar.SECOND));
- }
+ }
/**
@@ -189,4 +283,76 @@ public class JdbcOdbcUtils{
return new SQLException(th);
}
+
+ /**
+ * Convert a value from java.sql.Types to a value from to a System.Data.DbType
+ *
+ * @param type
+ * a JDBC type
+ * @return a ADO.NET type
+ * @throws SQLException
+ * if the type can not be converted
+ */
+ public static int convertJdbc2AdoNetType(int type) throws SQLException{
+ switch(type){
+ case Types.BIGINT:
+ return DbType.Int64;
+ case Types.BINARY:
+ case Types.BLOB:
+ case Types.LONGVARBINARY:
+ case Types.VARBINARY:
+ return DbType.Binary;
+ case Types.BIT:
+ case Types.BOOLEAN:
+ return DbType.Boolean;
+ case Types.CHAR:
+ return DbType.AnsiStringFixedLength;
+ case Types.CLOB:
+ case Types.DATALINK:
+ case Types.LONGVARCHAR:
+ case Types.NULL: // we hope that the DBMS can map any NULL values from VARCHAR
+ case Types.VARCHAR:
+ return DbType.AnsiString;
+ case Types.DATE:
+ return DbType.Date;
+ case Types.DECIMAL:
+ case Types.NUMERIC:
+ return DbType.Decimal;
+ case Types.DOUBLE:
+ return DbType.Double;
+ case Types.FLOAT:
+ case Types.REAL:
+ return DbType.Single;
+ case Types.INTEGER:
+ return DbType.Int32;
+ case Types.JAVA_OBJECT:
+ return DbType.Object;
+ case Types.LONGNVARCHAR:
+ case Types.NCLOB:
+ case Types.NVARCHAR:
+ return DbType.String;
+ case Types.NCHAR:
+ return DbType.StringFixedLength;
+ case Types.ROWID:
+ return DbType.Guid;
+ case Types.SMALLINT:
+ return DbType.Int16;
+ case Types.SQLXML:
+ return DbType.Xml;
+ case Types.TIME:
+ return DbType.Time;
+ case Types.TIMESTAMP:
+ return DbType.DateTime;
+ case Types.TINYINT:
+ return DbType.Byte;
+ case Types.ARRAY:
+ case Types.DISTINCT:
+ case Types.OTHER:
+ case Types.REF:
+ case Types.STRUCT:
+ break;
+
+ }
+ throw new SQLException("Not supported JDBC type:" + type);
+ }
}