diff --git a/jOOQ/src/main/java/org/jooq/impl/ConnectionProxy.java b/jOOQ/src/main/java/org/jooq/impl/ConnectionProxy.java index 2b8a646ccd..5a140f8c2f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ConnectionProxy.java +++ b/jOOQ/src/main/java/org/jooq/impl/ConnectionProxy.java @@ -54,7 +54,6 @@ import java.sql.Statement; import java.sql.Struct; import java.util.Map; import java.util.Properties; -import java.util.concurrent.Executor; import org.jooq.conf.Settings; import org.jooq.conf.StatementType; @@ -65,7 +64,7 @@ import org.jooq.conf.StatementType; * * @author Lukas Eder */ -class ConnectionProxy implements Connection { +class ConnectionProxy extends JDBC41Connection { private final Connection delegate; private final Settings settings; @@ -365,29 +364,4 @@ class ConnectionProxy implements Connection { public final Struct createStruct(String typeName, Object[] attributes) throws SQLException { return delegate.createStruct(typeName, attributes); } - - @Override - public void setSchema(String schema) throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getSchema() throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void abort(Executor executor) throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public int getNetworkTimeout() throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } } diff --git a/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java b/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java index d44beab577..d3f3c6accc 100644 --- a/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java @@ -231,7 +231,7 @@ class CursorImpl implements Cursor { /** * A wrapper for the underlying JDBC {@link ResultSet} and {@link Statement} */ - private final class CursorResultSet implements ResultSet { + private final class CursorResultSet extends JDBC41ResultSet { private final boolean keepStatementOpen; @@ -1193,16 +1193,6 @@ class CursorImpl implements Cursor { public final void updateNClob(String columnLabel, Reader reader) throws SQLException { ctx.resultSet().updateNClob(columnLabel, reader); } - - @Override - public T getObject(int columnIndex, Class type) throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public T getObject(String columnLabel, Class type) throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } } /** diff --git a/jOOQ/src/main/java/org/jooq/impl/DataSourceConnection.java b/jOOQ/src/main/java/org/jooq/impl/DataSourceConnection.java index a6851a18f9..802a190aa4 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DataSourceConnection.java +++ b/jOOQ/src/main/java/org/jooq/impl/DataSourceConnection.java @@ -68,7 +68,7 @@ import org.jooq.exception.DataAccessException; * * @author Lukas Eder */ -class DataSourceConnection implements Connection { +class DataSourceConnection extends JDBC41Connection { private final DataSource datasource; private final Settings settings; diff --git a/jOOQ/src/main/java/org/jooq/impl/DataSourceStatement.java b/jOOQ/src/main/java/org/jooq/impl/DataSourceStatement.java index fb42341d10..8dbc213564 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DataSourceStatement.java +++ b/jOOQ/src/main/java/org/jooq/impl/DataSourceStatement.java @@ -49,7 +49,7 @@ import javax.sql.DataSource; * @author Lukas Eder * @see DataSourceConnection */ -class DataSourceStatement implements Statement { +class DataSourceStatement extends JDBC41Statement { private final DataSourceConnection connection; private final Statement statement; diff --git a/jOOQ/src/main/java/org/jooq/impl/JDBC41Connection.java b/jOOQ/src/main/java/org/jooq/impl/JDBC41Connection.java new file mode 100644 index 0000000000..ef6985594e --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/JDBC41Connection.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com + * All rights reserved. + * + * This software is licensed to you under the Apache License, Version 2.0 + * (the "License"); You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name "jOOQ" nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package org.jooq.impl; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.concurrent.Executor; + +/** + * Add JDBC 4.1 API compliance to a JDBC 4.0 {@link Connection} + * + * @author Lukas Eder + */ +abstract class JDBC41Connection implements Connection { + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public void setSchema(String s) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public String getSchema() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public void abort(Executor executor) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public int getNetworkTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/JDBC41ResultSet.java b/jOOQ/src/main/java/org/jooq/impl/JDBC41ResultSet.java new file mode 100644 index 0000000000..304d17d23f --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/JDBC41ResultSet.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com + * All rights reserved. + * + * This software is licensed to you under the Apache License, Version 2.0 + * (the "License"); You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name "jOOQ" nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package org.jooq.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * Add JDBC 4.1 API compliance to a JDBC 4.0 {@link ResultSet} + * + * @author Lukas Eder + */ +abstract class JDBC41ResultSet implements ResultSet { + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public T getObject(int columnIndex, Class type0) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public T getObject(String columnLabel, Class type0) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/JDBC41Statement.java b/jOOQ/src/main/java/org/jooq/impl/JDBC41Statement.java new file mode 100644 index 0000000000..a06406c820 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/JDBC41Statement.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com + * All rights reserved. + * + * This software is licensed to you under the Apache License, Version 2.0 + * (the "License"); You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name "jOOQ" nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package org.jooq.impl; + +import java.sql.SQLException; +import java.sql.Statement; + +/** + * Add JDBC 4.1 API compliance to a JDBC 4.0 {@link Statement} + * + * @author Lukas Eder + */ +abstract class JDBC41Statement implements Statement { + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public void closeOnCompletion() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + // JDBC 4.1 compliance: @Override + @SuppressWarnings("unused") + public boolean isCloseOnCompletion() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/PreparedStatementProxy.java b/jOOQ/src/main/java/org/jooq/impl/PreparedStatementProxy.java index 621c2f5298..d7d77ce74b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/PreparedStatementProxy.java +++ b/jOOQ/src/main/java/org/jooq/impl/PreparedStatementProxy.java @@ -65,7 +65,7 @@ import java.util.Calendar; * * @author Lukas Eder */ -class PreparedStatementProxy implements PreparedStatement { +class PreparedStatementProxy extends JDBC41Statement implements PreparedStatement { private final Connection connection; private final Statement delegate; @@ -124,16 +124,6 @@ class PreparedStatementProxy implements PreparedStatement { this.columnNames = columnNames; } - @Override - public void closeOnCompletion() throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean isCloseOnCompletion() throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - // ------------------------------------------------------------------------ // XXX: Utilities // ------------------------------------------------------------------------