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

Moved JDBC 4.1 artefacts to a public org.jooq.tools.jdbc package, for
reuse in jOOQ Console and other modules
This commit is contained in:
Lukas Eder 2012-07-01 10:16:43 +02:00
parent 72715a1c7c
commit 2ba8e8acaa
8 changed files with 52 additions and 13 deletions

View File

@ -57,6 +57,7 @@ import java.util.Properties;
import org.jooq.conf.Settings;
import org.jooq.conf.StatementType;
import org.jooq.tools.jdbc.JDBC41Connection;
/**
* A proxy for a JDBC {@link Connection} that handles creation of prepared
@ -64,7 +65,7 @@ import org.jooq.conf.StatementType;
*
* @author Lukas Eder
*/
class ConnectionProxy extends JDBC41Connection {
class ConnectionProxy extends JDBC41Connection implements Connection {
private final Connection delegate;
private final Settings settings;

View File

@ -68,6 +68,7 @@ import org.jooq.Record;
import org.jooq.RecordHandler;
import org.jooq.Result;
import org.jooq.Table;
import org.jooq.tools.jdbc.JDBC41ResultSet;
/**
* @author Lukas Eder
@ -231,7 +232,7 @@ class CursorImpl<R extends Record> implements Cursor<R> {
/**
* A wrapper for the underlying JDBC {@link ResultSet} and {@link Statement}
*/
private final class CursorResultSet extends JDBC41ResultSet {
private final class CursorResultSet extends JDBC41ResultSet implements ResultSet {
private final boolean keepStatementOpen;

View File

@ -57,6 +57,7 @@ import javax.sql.DataSource;
import org.jooq.conf.Settings;
import org.jooq.exception.DataAccessException;
import org.jooq.tools.jdbc.JDBC41Connection;
/**
* A {@link DataSource}-enabled connection.
@ -68,7 +69,7 @@ import org.jooq.exception.DataAccessException;
*
* @author Lukas Eder
*/
class DataSourceConnection extends JDBC41Connection {
class DataSourceConnection extends JDBC41Connection implements Connection {
private final DataSource datasource;
private final Settings settings;

View File

@ -43,13 +43,15 @@ import java.sql.Statement;
import javax.sql.DataSource;
import org.jooq.tools.jdbc.JDBC41Statement;
/**
* A {@link DataSource}-enabled statement.
*
* @author Lukas Eder
* @see DataSourceConnection
*/
class DataSourceStatement extends JDBC41Statement {
class DataSourceStatement extends JDBC41Statement implements Statement {
private final DataSourceConnection connection;
private final Statement statement;

View File

@ -59,6 +59,8 @@ import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import org.jooq.tools.jdbc.JDBC41Statement;
/**
* A proxy for a JDBC {@link PreparedStatement} that simulates the API of a
* prepared statement, when in fact executing an ad-hoc {@link Statement}

View File

@ -33,7 +33,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.impl;
package org.jooq.tools.jdbc;
import java.sql.Connection;
import java.sql.SQLException;
@ -41,10 +41,13 @@ import java.util.concurrent.Executor;
/**
* Add JDBC 4.1 API compliance to a JDBC 4.0 {@link Connection}
* <p>
* Extend this type if you want to compile {@link Connection} implementations on
* both JDBC 4.0 (JDK 6) and 4.1 (JDK 7).
*
* @author Lukas Eder
*/
abstract class JDBC41Connection implements Connection {
public abstract class JDBC41Connection {
// JDBC 4.1 compliance: @Override
@SuppressWarnings("unused")

View File

@ -33,27 +33,30 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.impl;
package org.jooq.tools.jdbc;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Add JDBC 4.1 API compliance to a JDBC 4.0 {@link ResultSet}
* <p>
* Extend this type if you want to compile {@link ResultSet} implementations on
* both JDBC 4.0 (JDK 6) and 4.1 (JDK 7).
*
* @author Lukas Eder
*/
abstract class JDBC41ResultSet implements ResultSet {
public abstract class JDBC41ResultSet {
// JDBC 4.1 compliance: @Override
@SuppressWarnings("unused")
public <T> T getObject(int columnIndex, Class<T> type0) throws SQLException {
public <T> T getObject(int columnIndex, Class<T> type) 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 {
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -33,17 +33,27 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.impl;
package org.jooq.tools.jdbc;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
/**
* Add JDBC 4.1 API compliance to a JDBC 4.0 {@link Statement}
* Add JDBC 4.1 API compliance to a JDBC 4.0 {@link Statement}.
* <p>
* Extend this type if you want to compile {@link Statement},
* {@link PreparedStatement}, and {@link CallableStatement} implementations on
* both JDBC 4.0 (JDK 6) and 4.1 (JDK 7).
*
* @author Lukas Eder
*/
abstract class JDBC41Statement implements Statement {
public abstract class JDBC41Statement {
// ------------------------------------------------------------------------
// Methods from JDBC 4.1 java.sql.Statement
// ------------------------------------------------------------------------
// JDBC 4.1 compliance: @Override
@SuppressWarnings("unused")
@ -56,4 +66,20 @@ abstract class JDBC41Statement implements Statement {
public boolean isCloseOnCompletion() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
// ------------------------------------------------------------------------
// Methods from JDBC 4.1 java.sql.PreparedCall
// ------------------------------------------------------------------------
// JDBC 4.1 compliance: @Override
@SuppressWarnings("unused")
public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
// JDBC 4.1 compliance: @Override
@SuppressWarnings("unused")
public <T> T getObject(String parameterName, Class<T> type) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
}