[#1498] jOOQ does not compile using JDK 7 / JDBC 4.1. GitHub Issue #24

This commit is contained in:
Lukas Eder 2012-06-29 16:45:55 +02:00
parent a128acc898
commit 71bd87f33d
8 changed files with 201 additions and 51 deletions

View File

@ -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.");
}
}

View File

@ -231,7 +231,7 @@ class CursorImpl<R extends Record> implements Cursor<R> {
/**
* 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<R extends Record> implements Cursor<R> {
public final void updateNClob(String columnLabel, Reader reader) throws SQLException {
ctx.resultSet().updateNClob(columnLabel, reader);
}
@Override
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
}
/**

View File

@ -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;

View File

@ -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;

View File

@ -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.");
}
}

View File

@ -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> T getObject(int columnIndex, Class<T> type0) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
// JDBC 4.1 compliance: @Override
@SuppressWarnings("unused")
public <T> T getObject(String columnLabel, Class<T> type0) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -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.");
}
}

View File

@ -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
// ------------------------------------------------------------------------