Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:davechen
c3po
c3p0-build-on-1.6.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File c3p0-build-on-1.6.patch of Package c3po
diff --git a/src/java/com/mchange/v2/c3p0/ComboPooledDataSource.java b/src/java/com/mchange/v2/c3p0/ComboPooledDataSource.java index 9286338..7ebe0d5 100644 --- a/src/java/com/mchange/v2/c3p0/ComboPooledDataSource.java +++ b/src/java/com/mchange/v2/c3p0/ComboPooledDataSource.java @@ -616,6 +616,21 @@ public final class ComboPooledDataSource extends AbstractPoolBackedDataSource im throw new IOException("Unsupported Serialized Version: " + version); } } + + public boolean isWrapperFor( Class iface ) + { + return iface.isInstance(this); + } + + public Object unwrap( Class iface ) throws SQLException + { + if (this.isWrapperFor(iface)) { + return this; + } + else { + throw new SQLException("no object found"); + } + } } //now, referenceability happens exactly the same way it does for PoolBackedDataSource diff --git a/src/java/com/mchange/v2/c3p0/DriverManagerDataSource.java b/src/java/com/mchange/v2/c3p0/DriverManagerDataSource.java index 1862741..5f55a48 100644 --- a/src/java/com/mchange/v2/c3p0/DriverManagerDataSource.java +++ b/src/java/com/mchange/v2/c3p0/DriverManagerDataSource.java @@ -268,4 +268,19 @@ public final class DriverManagerDataSource extends DriverManagerDataSourceBase i throw new IOException("Unsupported Serialized Version: " + version); } } + + public boolean isWrapperFor( Class iface ) + { + return iface.isInstance(this); + } + + public Object unwrap( Class iface ) throws SQLException + { + if (this.isWrapperFor(iface)) { + return this; + } + else { + throw new SQLException("no object found"); + } + } } diff --git a/src/java/com/mchange/v2/c3p0/JndiRefForwardingDataSource.java b/src/java/com/mchange/v2/c3p0/JndiRefForwardingDataSource.java index e134552..548f32d 100644 --- a/src/java/com/mchange/v2/c3p0/JndiRefForwardingDataSource.java +++ b/src/java/com/mchange/v2/c3p0/JndiRefForwardingDataSource.java @@ -177,5 +177,25 @@ final class JndiRefForwardingDataSource extends JndiRefDataSourceBase implements throw new IOException("Unsupported Serialized Version: " + version); } } + + public boolean isWrapperFor( Class iface ) throws SQLException + { + return iface.isInstance(this) || iface.isInstance(inner()); + } + + public Object unwrap( Class iface ) throws SQLException + { + if (this.isWrapperFor(iface)) { + if (iface.isInstance(this)) { + return this; + } + else { + return inner(); + } + } + else { + throw new SQLException("no object found"); + } + } } diff --git a/src/java/com/mchange/v2/c3p0/PoolBackedDataSource.java b/src/java/com/mchange/v2/c3p0/PoolBackedDataSource.java index 8ec1ba7..f7d5a15 100644 --- a/src/java/com/mchange/v2/c3p0/PoolBackedDataSource.java +++ b/src/java/com/mchange/v2/c3p0/PoolBackedDataSource.java @@ -35,6 +35,8 @@ package com.mchange.v2.c3p0; +import java.sql.SQLException; + import com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource; public final class PoolBackedDataSource extends AbstractPoolBackedDataSource implements PooledDataSource @@ -50,5 +52,20 @@ public final class PoolBackedDataSource extends AbstractPoolBackedDataSource imp this(); initializeNamedConfig( configName, false ); } + + public boolean isWrapperFor( Class iface ) + { + return iface.isInstance(this); + } + + public Object unwrap( Class iface ) throws SQLException + { + if (this.isWrapperFor(iface)) { + return this; + } + else { + throw new SQLException("no object found"); + } + } } diff --git a/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java b/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java index 334737a..b78e6c0 100644 --- a/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java +++ b/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java @@ -908,7 +908,7 @@ public abstract class JdbcProxyGenerator extends DelegatorGenerator } // end-premature-detach-debug-only! - iw.println( "throw SqlUtils.toSQLException(\042You can't operate on a closed " + getInnerTypeName() + "!!!\042, exc);"); + iw.println( "throw new IllegalStateException(SqlUtils.toSQLException(\042You can't operate on a closed " + getInnerTypeName() + "!!!\042, exc));"); } iw.downIndent(); iw.println("}"); @@ -922,10 +922,10 @@ public abstract class JdbcProxyGenerator extends DelegatorGenerator iw.println("{"); iw.upIndent(); //iw.println( "exc.printStackTrace();" ); - iw.println( "throw parentPooledConnection.handleThrowable( exc );" ); + iw.println( "throw new RuntimeException(parentPooledConnection.handleThrowable( exc ));" ); iw.downIndent(); iw.println("}"); - iw.println("else throw SqlUtils.toSQLException( exc );"); + iw.println("else throw new RuntimeException(SqlUtils.toSQLException( exc ));"); iw.downIndent(); iw.println("}"); } diff --git a/src/java/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java b/src/java/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java index 5c6a4bc..ce0507e 100644 --- a/src/java/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java +++ b/src/java/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java @@ -36,6 +36,8 @@ package com.mchange.v2.c3p0.impl; import java.lang.reflect.*; +import java.io.InputStream; +import java.io.Reader; import java.sql.*; import java.util.*; import javax.sql.*; @@ -533,6 +535,7 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection private static class StatementProxyingSetManagedResultSet extends SetManagedResultSet { private Statement proxyStatement; + private boolean closed = false; StatementProxyingSetManagedResultSet(Set activeResultSets) { super( activeResultSets ); } @@ -542,6 +545,181 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection public Statement getStatement() throws SQLException { return (proxyStatement == null ? super.getStatement() : proxyStatement); } + + public boolean isWrapperFor( Class c ) throws SQLException + { + return c.isInstance(this) || c.isInstance(this.proxyStatement) || c.isInstance(super.getStatement()); + } + + public Object unwrap( Class c ) throws SQLException + { + if (c.isInstance(this)) { + return this; + } + else if (c.isInstance(this.proxyStatement)) { + return this.proxyStatement; + } + else if (c.isInstance(super.getStatement())) { + return super.getStatement(); + } + // should people be calling unwrap if isWrapperFor would return false? + return null; + } + + public void updateNClob( String column, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNClob( String s, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNClob( String s, NClob nc ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNClob( int i, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNClob( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNClob( int i, NClob nc ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateClob( String s, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateClob( String s, Reader reader, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateClob( int i, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateClob( int i, Reader reader, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateBlob( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateBlob( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateBlob( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateBlob( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateCharacterStream( String s, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateCharacterStream( String s, Reader reader, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateCharacterStream( int i, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateCharacterStream( int i, Reader reader, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateBinaryStream( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateBinaryStream( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateBinaryStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateBinaryStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateAsciiStream( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateAsciiStream( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateAsciiStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateAsciiStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNCharacterStream( String s, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNCharacterStream( String s, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNCharacterStream( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNCharacterStream( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateSQLXML( String s, SQLXML sx ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateSQLXML( int i, SQLXML sx ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNString( String label, String value ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateNString( int i, String value ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateRowId( String s, RowId x ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void updateRowId( int i, RowId x ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public Reader getNCharacterStream( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public Reader getNCharacterStream( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public String getNString( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public String getNString( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public SQLXML getSQLXML( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public SQLXML getSQLXML( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public NClob getNClob( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public NClob getNClob( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public RowId getRowId( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public RowId getRowId( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public synchronized void close() throws SQLException + { + closed = true; + super.close(); + } + + public boolean isClosed() + { + return closed; + } + + // stub methods - required by java.sql.ResultSet since 1.6 + public int getHoldability() + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } } /* @@ -648,6 +826,7 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection class ProxyCallableStatement extends FilterCallableStatement implements C3P0ProxyStatement { WrapperStatementHelper wsh; + private boolean closed = false; ProxyCallableStatement(CallableStatement is) { @@ -675,7 +854,207 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection { return wsh.doRawStatementOperation( m, target, args); } public void close() throws SQLException - { wsh.doClose(); } + { + closed = true; + wsh.doClose(); + } + + public boolean isClosed() + { + return closed; + } + + public void setPoolable( boolean poolable ) + { + // do nothing + } + + public boolean isPoolable() + { + return true; + } + + public boolean isWrapperFor( Class c ) + { + return c.isInstance(this) || c.isInstance(wsh); + } + + public Object unwrap( Class c ) + { + if (c.isInstance(this)) { + return this; + } + else if (c.isInstance(wsh)) { + return wsh; + } + // should people be calling unwrap if isWrapperFor would return false? + return null; + } + + public void setNClob( String parameter, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNClob( String s, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNClob( String s, NClob nc ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNClob( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNClob( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNClob( int i, NClob nc ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBlob( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBlob( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBlob( String s, Blob b ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBlob( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBlob( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBlob( int i, Blob b ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setClob( String s, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setClob( String s, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setClob( String s, Clob c ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setClob( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setClob( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setClob( int i, Clob c ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNCharacterStream( String s, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNCharacterStream( String s, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNCharacterStream( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNCharacterStream( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setCharacterStream( String s, Reader reader ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setCharacterStream( String s, Reader reader, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setCharacterStream( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setCharacterStream( int i, Reader r, int l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setCharacterStream( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBinaryStream( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBinaryStream( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBinaryStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBinaryStream( int i, InputStream inp, int l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBinaryStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setAsciiStream( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setAsciiStream( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setAsciiStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setAsciiStream( int i, InputStream inp, int l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setAsciiStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNString( String name, String value ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNString( int i, String value ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setSQLXML( String s, SQLXML sx ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setSQLXML( int i, SQLXML sx ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setRowId( String s, RowId r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setRowId( int i, RowId r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public Reader getCharacterStream( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public Reader getCharacterStream( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public Reader getNCharacterStream( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public Reader getNCharacterStream( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public String getNString( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public String getNString( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public SQLXML getSQLXML( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public SQLXML getSQLXML( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public NClob getNClob( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public NClob getNClob( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public RowId getRowId( String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public RowId getRowId( int i ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } } return new ProxyCallableStatement((CallableStatement) innerStmt ); @@ -685,6 +1064,7 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection class ProxyPreparedStatement extends FilterPreparedStatement implements C3P0ProxyStatement { WrapperStatementHelper wsh; + private boolean closed = false; ProxyPreparedStatement(PreparedStatement ps) { @@ -712,7 +1092,97 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection { return wsh.doRawStatementOperation( m, target, args); } public void close() throws SQLException - { wsh.doClose(); } + { + closed = true; + wsh.doClose(); + } + + public boolean isClosed() + { + return closed; + } + + public boolean isWrapperFor( Class c ) + { + return c.isInstance(this) || c.isInstance(wsh); + } + + public Object unwrap( Class c ) + { + if (c.isInstance(this)) { + return this; + } + else if (c.isInstance(wsh)) { + return wsh; + } + // should people be calling unwrap if isWrapperFor would return false? + return null; + } + + public void setPoolable( boolean poolable ) + { + // do nothing + return; + } + + public boolean isPoolable() + { + return true; + } + + public void setNClob( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNClob( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNClob( int i, NClob nc ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBlob( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBlob( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setClob( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setClob( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNCharacterStream( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNCharacterStream( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setCharacterStream( int i, Reader r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setCharacterStream( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBinaryStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setBinaryStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setAsciiStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setAsciiStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setSQLXML( int i, SQLXML sx ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setNString( int i, String s ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } + + public void setRowId( int i, RowId r ) throws SQLFeatureNotSupportedException + { throw new SQLFeatureNotSupportedException(); } } return new ProxyPreparedStatement((PreparedStatement) innerStmt ); @@ -722,6 +1192,7 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection class ProxyStatement extends FilterStatement implements C3P0ProxyStatement { WrapperStatementHelper wsh; + boolean closed = false; ProxyStatement(Statement s) { @@ -746,7 +1217,40 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection { return wsh.doRawStatementOperation( m, target, args); } public void close() throws SQLException - { wsh.doClose(); } + { + wsh.doClose(); + closed = true; + } + + public boolean isPoolable() + { + return true; + } + + public void setPoolable( boolean poolable ) + { + // do nothing + return; + } + + public boolean isClosed() + { + return closed; + } + + public boolean isWrapperFor( Class c ) + { + return c.isInstance(this); + } + + public Object unwrap( Class c ) + { + if (this.isWrapperFor(c)) { + return this; + } + // should people be calling unwrap if isWrapperFor returns false? + return null; + } } return new ProxyStatement( innerStmt ); @@ -1199,6 +1703,17 @@ public final class C3P0PooledConnection extends AbstractC3P0PooledConnection logger.log(MLevel.WARNING, "Broken Connection Close Error. ", e); } } + +// stub methods, required by javax.sql.PooledConnection since 1.6 + public void addStatementEventListener( StatementEventListener listener ) + { + throw new NoSuchMethodError("stub method"); + } + + public void removeStatementEventListener( StatementEventListener listener ) + { + throw new NoSuchMethodError("stub method"); + } } diff --git a/src/java/com/mchange/v2/c3p0/impl/C3P0PooledConnectionPoolManager.java b/src/java/com/mchange/v2/c3p0/impl/C3P0PooledConnectionPoolManager.java index bb7df37..97a8827 100644 --- a/src/java/com/mchange/v2/c3p0/impl/C3P0PooledConnectionPoolManager.java +++ b/src/java/com/mchange/v2/c3p0/impl/C3P0PooledConnectionPoolManager.java @@ -138,11 +138,10 @@ public final class C3P0PooledConnectionPoolManager // after the hung thread has been cleared and replaced // (in hopes of getting the thread to terminate for // garbage collection) - timer, - threadLabel ); + timer ); } else - out = new ThreadPoolAsynchronousRunner( num_threads, true, timer, threadLabel ); + out = new ThreadPoolAsynchronousRunner( num_threads, true, timer ); return out; } diff --git a/src/java/com/mchange/v2/c3p0/impl/NewPooledConnection.java b/src/java/com/mchange/v2/c3p0/impl/NewPooledConnection.java index 7ad033c..281c942 100644 --- a/src/java/com/mchange/v2/c3p0/impl/NewPooledConnection.java +++ b/src/java/com/mchange/v2/c3p0/impl/NewPooledConnection.java @@ -832,4 +832,15 @@ public final class NewPooledConnection extends AbstractC3P0PooledConnection{ } } } + +// stub methods, required by javax.sql.PooledConnection since 1.6 + public void addStatementEventListener( StatementEventListener listener ) + { + throw new NoSuchMethodError("stub method"); + } + + public void removeStatementEventListener( StatementEventListener listener ) + { + throw new NoSuchMethodError("stub method"); + } } diff --git a/src/java/com/mchange/v2/c3p0/impl/NullStatementSetManagedResultSet.java b/src/java/com/mchange/v2/c3p0/impl/NullStatementSetManagedResultSet.java index 48dc25f..54be0ea 100644 --- a/src/java/com/mchange/v2/c3p0/impl/NullStatementSetManagedResultSet.java +++ b/src/java/com/mchange/v2/c3p0/impl/NullStatementSetManagedResultSet.java @@ -41,19 +41,289 @@ */ package com.mchange.v2.c3p0.impl; +import java.io.InputStream; +import java.io.Reader; +import java.sql.NClob; import java.sql.ResultSet; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLXML; import java.sql.Statement; import java.util.Set; final class NullStatementSetManagedResultSet extends SetManagedResultSet { +private boolean closed = false; + NullStatementSetManagedResultSet(Set activeResultSets) { super( activeResultSets ); } NullStatementSetManagedResultSet(ResultSet inner, Set activeResultSets) { super( inner, activeResultSets); } +public boolean isWrapperFor( Class c ) +{ + return c.isInstance(this); +} + +public Object unwrap( Class c ) +{ + if (c.isInstance(this)) { + return this; + } + // should people be calling unwrap when isWrapperFor would return false + return null; +} + public Statement getStatement() { return null; } + +public synchronized void close() throws SQLException +{ + closed = true; + super.close(); +} + +public boolean isClosed() +{ + return closed; +} + +public void updateNClob( String column, Reader reader ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNClob( String column, Reader reader, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNClob( String column, NClob nc ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNClob( int i, Reader reader ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNClob( int i, Reader reader, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNClob( int i, NClob nc ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateClob( String s, Reader reader ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateClob( String s, Reader r, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateClob( int i, Reader reader ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateClob( int i, Reader r, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateBlob( String s, InputStream inp ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateBlob( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateBlob( int i, InputStream inp ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateBlob( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateCharacterStream( String s, Reader reader ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateCharacterStream( String s, Reader reader, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateCharacterStream( int i, Reader reader ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateCharacterStream( int i, Reader reader, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateBinaryStream( String s, InputStream inp ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateBinaryStream( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateBinaryStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateBinaryStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateAsciiStream( String s, InputStream inp ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateAsciiStream( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateAsciiStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateAsciiStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNCharacterStream( String s, Reader reader ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNCharacterStream( String s, Reader reader, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNCharacterStream( int i, Reader reader ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNCharacterStream( int i, Reader reader, long l ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateSQLXML( String s, SQLXML sx ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateSQLXML( int i, SQLXML sx ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNString( String label, String value ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateNString( int i, String value ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateRowId( String s, RowId x ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public void updateRowId( int i, RowId x ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public Reader getNCharacterStream( int i ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public Reader getNCharacterStream( String s ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public String getNString( int i ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public String getNString( String s ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public SQLXML getSQLXML( int i ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public SQLXML getSQLXML( String s ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public NClob getNClob( int i ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public NClob getNClob( String s ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public RowId getRowId( String s ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +public RowId getRowId( int i ) throws SQLFeatureNotSupportedException +{ + throw new SQLFeatureNotSupportedException(); +} + +// stub methods - required by java.sql.ResultSet since 1.6 +public int getHoldability() +{ + throw new RuntimeException(new NoSuchMethodException("stub method")); +} } diff --git a/src/java/com/mchange/v2/c3p0/impl/SetManagedDatabaseMetaData.java b/src/java/com/mchange/v2/c3p0/impl/SetManagedDatabaseMetaData.java index 671d2dc..8c2523e 100644 --- a/src/java/com/mchange/v2/c3p0/impl/SetManagedDatabaseMetaData.java +++ b/src/java/com/mchange/v2/c3p0/impl/SetManagedDatabaseMetaData.java @@ -143,6 +143,56 @@ final class SetManagedDatabaseMetaData extends FilterDatabaseMetaData { return new NullStatementSetManagedResultSet( inner.getUDTs(a, b, c, d), activeResultSets ); } + + public boolean isWrapperFor( Class c ) + { + return c.isInstance(this); + } + + public Object unwrap( Class c ) + { + if (this.isWrapperFor(c)) { + return this; + } + // should people be calling unwrap if isWrapperFor would return false? + return null; + } + + // stub method required by java.sql.DatabaseMetaData since 1.6 + public ResultSet getFunctionColumns( String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern ) + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public ResultSet getFunctions( String catalog, String schemaPattern, String functionNamePattern ) + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public ResultSet getClientInfoProperties() + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public boolean autoCommitFailureClosesAllResultSets() + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public boolean supportsStoredFunctionsUsingCallSyntax() + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public ResultSet getSchemas( String catalog, String schemaPattern ) + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public RowIdLifetime getRowIdLifetime() + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } } diff --git a/src/java/com/mchange/v2/c3p0/impl/SnatchFromSetResultSet.java b/src/java/com/mchange/v2/c3p0/impl/SnatchFromSetResultSet.java index fc002db..248901a 100644 --- a/src/java/com/mchange/v2/c3p0/impl/SnatchFromSetResultSet.java +++ b/src/java/com/mchange/v2/c3p0/impl/SnatchFromSetResultSet.java @@ -36,6 +36,8 @@ package com.mchange.v2.c3p0.impl; import java.sql.*; +import java.io.InputStream; +import java.io.Reader; import java.util.Set; import com.mchange.v2.sql.filter.FilterResultSet; @@ -51,6 +53,27 @@ final class SnatchFromSetResultSet extends FilterResultSet this.inner = inner; activeResultSets.add( inner ); } + + public boolean isWrapperFor( Class c ) + { + return c.isInstance(this) || c.isInstance(this.inner) || c.isInstance(this.activeResultSets); + } + + public Object unwrap( Class c ) + { + if (c.isInstance(this)) { + return this; + } + else if (c.isInstance(this.inner)) { + return this.inner; + } + else if (c.isInstance(this.activeResultSets)) { + return this.activeResultSets; + } + + // should people be calling unwrap when isWrapperFor would return false? + return null; + } public synchronized void close() throws SQLException { @@ -58,4 +81,245 @@ final class SnatchFromSetResultSet extends FilterResultSet activeResultSets.remove( inner ); inner = null; } + + public boolean isClosed() + { + return (inner == null); + } + + public void updateNClob( String column, Reader reader ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNClob( String s, Reader r, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNClob( String s, NClob nc ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNClob( int i, Reader reader ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNClob( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNClob( int i, NClob nc ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateClob( String s, Reader reader ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateClob( String s, Reader reader, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateClob( int i, Reader reader ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateClob( int i, Reader reader, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBlob( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBlob( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBlob( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBlob( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateCharacterStream( String s, Reader reader ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateCharacterStream( String s, Reader reader, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateCharacterStream( int i, Reader reader ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateCharacterStream( int i, Reader reader, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBinaryStream( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBinaryStream( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBinaryStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateBinaryStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateAsciiStream( String s, InputStream inp ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateAsciiStream( String s, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateAsciiStream( int i, InputStream inp ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateAsciiStream( int i, InputStream inp, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNCharacterStream( String s, Reader r ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNCharacterStream( String s, Reader r, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNCharacterStream( int i, Reader r ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNCharacterStream( int i, Reader r, long l ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateSQLXML( String s, SQLXML sx ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateSQLXML( int i, SQLXML sx ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNString( String label, String value ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateNString( int i, String value ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateRowId( String s, RowId x ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public void updateRowId( int i, RowId x ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public Reader getNCharacterStream( int i ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public Reader getNCharacterStream( String s ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public String getNString( int i ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public String getNString( String s ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public SQLXML getSQLXML( int i ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public SQLXML getSQLXML( String s ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public NClob getNClob( int i ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public NClob getNClob( String s ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public RowId getRowId( String s ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public RowId getRowId( int i ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + // stub methods - required by java.sql.ResultSet since 1.6 + public int getHoldability() + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } } diff --git a/src/java/com/mchange/v2/c3p0/test/FreezableDriverManagerDataSource.java b/src/java/com/mchange/v2/c3p0/test/FreezableDriverManagerDataSource.java index 4d55da3..92c5bc3 100644 --- a/src/java/com/mchange/v2/c3p0/test/FreezableDriverManagerDataSource.java +++ b/src/java/com/mchange/v2/c3p0/test/FreezableDriverManagerDataSource.java @@ -292,4 +292,24 @@ public final class FreezableDriverManagerDataSource extends DriverManagerDataSou throw new IOException("Unsupported Serialized Version: " + version); } } + + public boolean isWrapperFor( Class iface ) throws SQLException + { + return iface.isInstance(this) || iface.isInstance(driver()); + } + + public Object unwrap( Class iface ) throws SQLException + { + if (this.isWrapperFor(iface)) { + if (iface.isInstance(this)) { + return this; + } + else { + return driver(); + } + } + else { + throw new SQLException("no object found"); + } + } } diff --git a/src/java/com/mchange/v2/c3p0/util/CloseReportingConnectionWrapper.java b/src/java/com/mchange/v2/c3p0/util/CloseReportingConnectionWrapper.java index bb6420d..f7fe4ec 100644 --- a/src/java/com/mchange/v2/c3p0/util/CloseReportingConnectionWrapper.java +++ b/src/java/com/mchange/v2/c3p0/util/CloseReportingConnectionWrapper.java @@ -36,6 +36,7 @@ package com.mchange.v2.c3p0.util; import java.sql.*; +import java.util.Properties; import com.mchange.v2.sql.filter.*; public class CloseReportingConnectionWrapper extends FilterConnection @@ -49,4 +50,73 @@ public class CloseReportingConnectionWrapper extends FilterConnection new SQLWarning("Connection.close() called!").printStackTrace(); super.close(); } + + public Struct createStruct( String typename, Object[] attrs ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public Array createArrayOf( String typename, Object[] elements ) throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public SQLXML createSQLXML() throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public NClob createNClob() throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public Blob createBlob() throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public Clob createClob() throws SQLFeatureNotSupportedException + { + throw new SQLFeatureNotSupportedException(); + } + + public boolean isWrapperFor( Class c ) + { + return c.isInstance(this); + } + + public Object unwrap( Class c ) + { + if (this.isWrapperFor(c)) { + return this; + } + return null; + } + + // stub methods required by java.sql.Connection since 1.6 + public Properties getClientInfo() + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public String getClientInfo( String name ) + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public void setClientInfo( Properties p ) + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public void setClientInfo( String name, String value ) + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } + + public boolean isValid( int timeout ) + { + throw new RuntimeException(new NoSuchMethodException("stub method")); + } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor