OPENJPA-6: Implement JDBC 4 methods in delegates.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@990218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Milosz Tylenda 2010-08-27 18:05:34 +00:00
parent 52f468bf3b
commit 96ee7d32e9
2 changed files with 85 additions and 2 deletions

View File

@ -19,16 +19,24 @@
package org.apache.openjpa.lib.jdbc;
import java.lang.reflect.Constructor;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;
import org.apache.openjpa.lib.util.Closeable;
import org.apache.openjpa.lib.util.ConcreteClassGenerator;
@ -468,7 +476,8 @@ public abstract class DelegatingConnection implements Connection, Closeable {
return stmnt;
}
// java.sql.Wrapper implementation (JDBC 4)
// JDBC 4.0 methods follow.
public boolean isWrapperFor(Class iface) {
return iface.isAssignableFrom(getDelegate().getClass());
}
@ -479,4 +488,48 @@ public abstract class DelegatingConnection implements Connection, Closeable {
else
return null;
}
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
return _conn.createArrayOf(typeName, elements);
}
public Blob createBlob() throws SQLException {
return _conn.createBlob();
}
public Clob createClob() throws SQLException {
return _conn.createClob();
}
public NClob createNClob() throws SQLException {
return _conn.createNClob();
}
public SQLXML createSQLXML() throws SQLException {
return _conn.createSQLXML();
}
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
return _conn.createStruct(typeName, attributes);
}
public Properties getClientInfo() throws SQLException {
return _conn.getClientInfo();
}
public String getClientInfo(String name) throws SQLException {
return _conn.getClientInfo(name);
}
public boolean isValid(int timeout) throws SQLException {
return _conn.isValid(timeout);
}
public void setClientInfo(Properties properties) throws SQLClientInfoException {
_conn.setClientInfo(properties);
}
public void setClientInfo(String name, String value) throws SQLClientInfoException {
_conn.setClientInfo(name, value);
}
}

View File

@ -22,6 +22,7 @@ import java.lang.reflect.Constructor;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.RowIdLifetime;
import java.sql.SQLException;
import org.apache.openjpa.lib.util.ConcreteClassGenerator;
@ -801,7 +802,8 @@ public abstract class DelegatingDatabaseMetaData implements DatabaseMetaData {
return _metaData;
}
// java.sql.Wrapper implementation (JDBC 4)
// JDBC 4.0 methods follow.
public boolean isWrapperFor(Class iface) {
return iface.isAssignableFrom(getDelegate().getClass());
}
@ -812,4 +814,32 @@ public abstract class DelegatingDatabaseMetaData implements DatabaseMetaData {
else
return null;
}
public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
return _metaData.autoCommitFailureClosesAllResultSets();
}
public ResultSet getClientInfoProperties() throws SQLException {
return _metaData.getClientInfoProperties();
}
public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException {
return _metaData.getFunctionColumns(catalog, schemaPattern, functionNamePattern, columnNamePattern);
}
public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException {
return _metaData.getFunctions(catalog, schemaPattern, functionNamePattern);
}
public RowIdLifetime getRowIdLifetime() throws SQLException {
return _metaData.getRowIdLifetime();
}
public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
return _metaData.getSchemas(catalog, schemaPattern);
}
public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
return _metaData.supportsStoredFunctionsUsingCallSyntax();
}
}