From 984d308b07339dbe0b242dbf5ac2f9df6387b6ab Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 12 Mar 2021 10:50:55 +0100 Subject: [PATCH] [jOOQ/jOOQ#11512] ParsingConnection should infer bind variable type from PreparedStatement calls This includes: - [jOOQ/jOOQ#11623] Refactor a few internal checked exception throwing functional interfaces --- .../java/org/jooq/impl/AbstractContext.java | 5 - .../java/org/jooq/impl/AbstractQuery.java | 18 +- .../java/org/jooq/impl/AbstractRecord.java | 6 +- .../main/java/org/jooq/impl/CursorImpl.java | 6 +- .../org/jooq/impl/DefaultRenderContext.java | 17 + .../src/main/java/org/jooq/impl/MetaImpl.java | 20 +- .../java/org/jooq/impl/ParsingConnection.java | 49 +- .../java/org/jooq/impl/ParsingStatement.java | 1262 ++++++++++++++++- .../java/org/jooq/impl/RecordDelegate.java | 4 +- .../java/org/jooq/impl/RecordOperation.java | 56 - 10 files changed, 1304 insertions(+), 139 deletions(-) delete mode 100644 jOOQ/src/main/java/org/jooq/impl/RecordOperation.java diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractContext.java b/jOOQ/src/main/java/org/jooq/impl/AbstractContext.java index f3501b3146..5397fdc6b7 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractContext.java @@ -330,11 +330,6 @@ abstract class AbstractContext> extends AbstractScope imple return (C) this; } - @FunctionalInterface - private interface BooleanConsumer { - void accept(boolean b); - } - @Override public final C data(Object key, Object value, Consumer consumer) { return toggle( diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java b/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java index 68b6e7363d..3ad9016cbb 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java @@ -83,6 +83,7 @@ import org.jooq.conf.StatementType; import org.jooq.exception.ControlFlowSignal; import org.jooq.exception.DataAccessException; import org.jooq.exception.DetachedException; +import org.jooq.impl.DefaultRenderContext.Rendered; import org.jooq.tools.Ints; import org.jooq.tools.JooqLogger; @@ -488,23 +489,6 @@ abstract class AbstractQuery extends AbstractFetchable impl return true; } - static class Rendered { - String sql; - QueryPartList> bindValues; - int skipUpdateCounts; - - Rendered(String sql, QueryPartList> bindValues, int skipUpdateCounts) { - this.sql = sql; - this.bindValues = bindValues; - this.skipUpdateCounts = skipUpdateCounts; - } - - @Override - public String toString() { - return sql; - } - } - private final Rendered getSQL0(ExecuteContext ctx) { Rendered result; DefaultRenderContext render; diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractRecord.java b/jOOQ/src/main/java/org/jooq/impl/AbstractRecord.java index 6472f7234d..5a1b6a74f5 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractRecord.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractRecord.java @@ -336,7 +336,7 @@ abstract class AbstractRecord extends AbstractStore implements Record { else if (Tools.nonReplacingEmbeddable(field)) return (T) Tools .newRecord(fetched, ((EmbeddableTableField) field).recordType) - .operate(new TransferRecordState(embeddedFields(field))); + .operate(new TransferRecordState<>(embeddedFields(field))); else throw Tools.indexFail(fields, field); } @@ -850,7 +850,7 @@ abstract class AbstractRecord extends AbstractStore implements Record { return Tools.newRecord(fetched, type, fields, configuration()).operate(new TransferRecordState<>(null)); } - private class TransferRecordState implements RecordOperation { + private class TransferRecordState implements ThrowingFunction { private final Field[] targetFields; @@ -859,7 +859,7 @@ abstract class AbstractRecord extends AbstractStore implements Record { } @Override - public R operate(R target) throws MappingException { + public R apply(R target) throws MappingException { AbstractRecord source = AbstractRecord.this; try { diff --git a/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java b/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java index bbd0c5aab1..1fe4394c19 100644 --- a/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java @@ -1453,7 +1453,7 @@ final class CursorImpl extends AbstractCursor { throw new UnsupportedOperationException(); } - private class CursorRecordInitialiser implements RecordOperation { + private class CursorRecordInitialiser implements ThrowingFunction { private final AbstractRow initialiserFields; private int offset; @@ -1469,7 +1469,7 @@ final class CursorImpl extends AbstractCursor { } @Override - public AbstractRecord operate(AbstractRecord record) throws SQLException { + public AbstractRecord apply(AbstractRecord record) throws SQLException { ctx.record(record); listener.recordStart(ctx); int size = initialiserFields.size(); @@ -1528,7 +1528,7 @@ final class CursorImpl extends AbstractCursor { } if (nested != null) { - value = (T) Tools.newRecord(true, recordType, nested, ((DefaultExecuteContext) ctx).originalConfiguration()) + value = (T) Tools.newRecord(true, (Class) recordType, nested, ((DefaultExecuteContext) ctx).originalConfiguration()) .operate(new CursorRecordInitialiser(nested, offset + index)); offset += nested.size() - 1; diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java index 60bc661f35..507c17df59 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java @@ -962,4 +962,21 @@ class DefaultRenderContext extends AbstractContext implements Ren log.debug("Re-render query", "Forcing bind variable inlining as " + configuration().dialect() + " does not support " + peekIndex() + " bind variables (or more) in a single query"); } } + + static class Rendered { + String sql; + QueryPartList> bindValues; + int skipUpdateCounts; + + Rendered(String sql, QueryPartList> bindValues, int skipUpdateCounts) { + this.sql = sql; + this.bindValues = bindValues; + this.skipUpdateCounts = skipUpdateCounts; + } + + @Override + public String toString() { + return sql; + } + } } diff --git a/jOOQ/src/main/java/org/jooq/impl/MetaImpl.java b/jOOQ/src/main/java/org/jooq/impl/MetaImpl.java index 8a2e4dda12..f2d1e54601 100644 --- a/jOOQ/src/main/java/org/jooq/impl/MetaImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/MetaImpl.java @@ -157,7 +157,7 @@ final class MetaImpl extends AbstractMeta { this.inverseSchemaCatalog = INVERSE_SCHEMA_CATALOG.contains(dialect()); } - final R catalogSchema(Catalog catalog, Schema schema, ThrowingBiFunction function) throws SQLException { + final R catalogSchema(Catalog catalog, Schema schema, ThrowingBiFunction function) throws SQLException { return catalogSchema( catalog != null ? catalog.getName() : null, schema != null ? schema.getName() : null, @@ -165,7 +165,7 @@ final class MetaImpl extends AbstractMeta { ); } - final R catalogSchema(String catalog, String schema, ThrowingBiFunction function) throws SQLException { + final R catalogSchema(String catalog, String schema, ThrowingBiFunction function) throws SQLException { String c = defaultIfEmpty(catalog, null); String s = defaultIfEmpty(schema, null); @@ -176,22 +176,12 @@ final class MetaImpl extends AbstractMeta { return function.apply(c, s); } - @FunctionalInterface - private interface ThrowingBiFunction { - R apply(T1 t1, T2 t2) throws SQLException; - } - - @FunctionalInterface - private interface MetaFunction { - Result run(DatabaseMetaData meta) throws SQLException; - } - - private final Result meta(MetaFunction consumer) { + private final Result meta(ThrowingFunction, SQLException> function) { if (databaseMetaData == null) - return dsl().connectionResult(connection -> consumer.run(connection.getMetaData())); + return dsl().connectionResult(connection -> function.apply(connection.getMetaData())); try { - return consumer.run(databaseMetaData); + return function.apply(databaseMetaData); } catch (SQLException e) { throw new DataAccessException("Error while running MetaFunction", e); diff --git a/jOOQ/src/main/java/org/jooq/impl/ParsingConnection.java b/jOOQ/src/main/java/org/jooq/impl/ParsingConnection.java index 24829f1fba..7b51cfc52f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParsingConnection.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParsingConnection.java @@ -44,7 +44,9 @@ import java.sql.Statement; import org.jooq.Configuration; import org.jooq.DSLContext; +import org.jooq.Param; import org.jooq.Parser; +import org.jooq.impl.DefaultRenderContext.Rendered; import org.jooq.tools.JooqLogger; import org.jooq.tools.jdbc.DefaultConnection; @@ -55,9 +57,9 @@ final class ParsingConnection extends DefaultConnection { private static final JooqLogger log = JooqLogger.getLogger(ParsingConnection.class); - private final Configuration configuration; - private final DSLContext ctx; - private final Parser parser; + final Configuration configuration; + final DSLContext ctx; + final Parser parser; ParsingConnection(Configuration configuration) { super(configuration.connectionProvider().acquire()); @@ -67,10 +69,15 @@ final class ParsingConnection extends DefaultConnection { this.parser = ctx.parser(); } - final String translate(String sql) { + final Rendered translate(String sql, Param... bindValues) { log.debug("Translating from", sql); - String result = ctx.render(parser.parseQuery(sql)); - log.debug("Translating to", result); + DefaultRenderContext render = (DefaultRenderContext) ctx.renderContext(); + Rendered result = new Rendered( + render.visit(parser.parseQuery(sql, (Object[]) bindValues)).render(), + render.bindValues(), + render.skipUpdateCounts() + ); + log.debug("Translating to", result.sql); return result; } @@ -89,49 +96,61 @@ final class ParsingConnection extends DefaultConnection { return new ParsingStatement(this, getDelegate().createStatement(resultSetType, resultSetConcurrency, resultSetHoldability)); } + private final ThrowingFunction[], PreparedStatement, SQLException> prepareAndBind( + String sql, + ThrowingFunction f + ) { + return p -> { + Rendered rendered = translate(sql, p); + PreparedStatement s = f.apply(rendered.sql); + new DefaultBindContext(configuration, s).visit(rendered.bindValues); + return s; + }; + } + @Override public final PreparedStatement prepareStatement(String sql) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareStatement(translate(sql))); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareStatement(s))); } @Override public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareStatement(translate(sql), resultSetType, resultSetConcurrency)); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareStatement(s, resultSetType, resultSetConcurrency))); } @Override public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareStatement(translate(sql), resultSetType, resultSetConcurrency, resultSetHoldability)); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareStatement(s, resultSetType, resultSetConcurrency, resultSetHoldability))); } @Override public final PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareStatement(translate(sql), autoGeneratedKeys)); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareStatement(s, autoGeneratedKeys))); } @Override public final PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareStatement(translate(sql), columnIndexes)); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareStatement(s, columnIndexes))); } @Override public final PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareStatement(translate(sql), columnNames)); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareStatement(s, columnNames))); } @Override public final CallableStatement prepareCall(String sql) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareCall(translate(sql))); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareCall(s))); } @Override public final CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareCall(sql, resultSetType, resultSetConcurrency)); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareCall(s, resultSetType, resultSetConcurrency))); } @Override public final CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { - return new ParsingStatement(this, getDelegate().prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability)); + return new ParsingStatement(this, prepareAndBind(sql, s -> getDelegate().prepareCall(s, resultSetType, resultSetConcurrency, resultSetHoldability))); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/ParsingStatement.java b/jOOQ/src/main/java/org/jooq/impl/ParsingStatement.java index e29c27c587..7df3ab1769 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParsingStatement.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParsingStatement.java @@ -37,98 +37,1314 @@ */ package org.jooq.impl; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; +import static org.jooq.impl.DSL.val; +import static org.jooq.impl.SQLDataType.NVARCHAR; +import static org.jooq.impl.Tools.EMPTY_PARAM; -import org.jooq.tools.jdbc.DefaultCallableStatement; +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.Date; +import java.sql.NClob; +import java.sql.ParameterMetaData; +import java.sql.PreparedStatement; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLType; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + +import org.jooq.Param; /** * @author Lukas Eder */ -final class ParsingStatement extends DefaultCallableStatement { +final class ParsingStatement implements CallableStatement { - private final ParsingConnection connection; + private final ParsingConnection connection; + private final Statement statement; + private final ThrowingFunction[], PreparedStatement, SQLException> prepared; + private final List> flags; + private final List> binds; + private PreparedStatement last; ParsingStatement(ParsingConnection connection, Statement statement) { - super(statement); - this.connection = connection; + this.statement = statement; + this.prepared = null; + this.flags = null; + this.binds = null; + } + + ParsingStatement(ParsingConnection connection, ThrowingFunction[], PreparedStatement, SQLException> lazy) { + this.connection = connection; + this.statement = null; + this.prepared = lazy; + this.flags = new ArrayList<>(); + this.binds = new ArrayList<>(); + } + + private final List> bindValues(int index) { + int size = binds.size(); + int reserve = index - size; + + if (reserve > 0) + binds.addAll(Collections.nCopies(reserve, null)); + + return binds; + } + + // ------------------------------------------------------------------------- + // XXX: Flags + // ------------------------------------------------------------------------- + + private final SQLException closed() { + return new SQLException("Statement is closed or not yet prepared."); + } + + private final Statement statement() throws SQLException { + if (last != null) + return last; + else if (statement != null) + return statement; + else + throw closed(); + } + + private final void setFlag(ThrowingConsumer set) throws SQLException { + if (statement != null) + set.accept(statement); + else + flags.add(set); } + @Override + public final void setPoolable(boolean poolable) throws SQLException { + setFlag(s -> s.setPoolable(poolable)); + } + + @Override + public final boolean isPoolable() throws SQLException { + return statement().isPoolable(); + } + + @Override + public final void setFetchDirection(int direction) throws SQLException { + setFlag(s -> s.setFetchDirection(direction)); + } + + @Override + public final int getFetchDirection() throws SQLException { + return statement().getFetchDirection(); + } + + @Override + public final void setFetchSize(int rows) throws SQLException { + setFlag(s -> s.setFetchSize(rows)); + } + + @Override + public final int getFetchSize() throws SQLException { + return statement().getFetchSize(); + } + + @Override + public final void setMaxFieldSize(int max) throws SQLException { + setFlag(s -> s.setMaxFieldSize(max)); + } + + @Override + public final int getMaxFieldSize() throws SQLException { + return statement().getMaxFieldSize(); + } + + @Override + public final void setMaxRows(int max) throws SQLException { + setFlag(s -> s.setMaxRows(max)); + } + + @Override + public final int getMaxRows() throws SQLException { + return statement().getMaxRows(); + } + + @Override + public final void setQueryTimeout(int seconds) throws SQLException { + setFlag(s -> s.setQueryTimeout(seconds)); + } + + @Override + public final int getQueryTimeout() throws SQLException { + return statement().getQueryTimeout(); + } + + @Override + public final void setEscapeProcessing(boolean enable) throws SQLException { + setFlag(s -> s.setEscapeProcessing(enable)); + } + + @Override + public final void setCursorName(String name) throws SQLException { + setFlag(s -> s.setCursorName(name)); + } + + @Override + public final int getResultSetConcurrency() throws SQLException { + return statement().getResultSetConcurrency(); + } + + @Override + public final int getResultSetType() throws SQLException { + return statement().getResultSetType(); + } + + @Override + public final int getResultSetHoldability() throws SQLException { + return statement().getResultSetHoldability(); + } + + // ------------------------------------------------------------------------- + // XXX: Static statement execution + // ------------------------------------------------------------------------- + @Override public final ResultSet executeQuery(String sql) throws SQLException { - return super.executeQuery(connection.translate(sql)); + return statement.executeQuery(connection.translate(sql).sql); } @Override public final int executeUpdate(String sql) throws SQLException { - return super.executeUpdate(connection.translate(sql)); + return statement.executeUpdate(connection.translate(sql).sql); } @Override public final int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { - return super.executeUpdate(connection.translate(sql), autoGeneratedKeys); + return statement.executeUpdate(connection.translate(sql).sql, autoGeneratedKeys); } @Override public final int executeUpdate(String sql, int[] columnIndexes) throws SQLException { - return super.executeUpdate(connection.translate(sql), columnIndexes); + return statement.executeUpdate(connection.translate(sql).sql, columnIndexes); } @Override public final int executeUpdate(String sql, String[] columnNames) throws SQLException { - return super.executeUpdate(connection.translate(sql), columnNames); + return statement.executeUpdate(connection.translate(sql).sql, columnNames); } @Override public final boolean execute(String sql) throws SQLException { - return super.execute(connection.translate(sql)); + return statement.execute(connection.translate(sql).sql); } @Override public final boolean execute(String sql, int autoGeneratedKeys) throws SQLException { - return super.execute(connection.translate(sql), autoGeneratedKeys); + return statement.execute(connection.translate(sql).sql, autoGeneratedKeys); } @Override public final boolean execute(String sql, int[] columnIndexes) throws SQLException { - return super.execute(connection.translate(sql), columnIndexes); + return statement.execute(connection.translate(sql).sql, columnIndexes); } @Override public final boolean execute(String sql, String[] columnNames) throws SQLException { - return super.execute(connection.translate(sql), columnNames); + return statement.execute(connection.translate(sql).sql, columnNames); } @Override public final long executeLargeUpdate(String sql) throws SQLException { - return super.executeLargeUpdate(connection.translate(sql)); + return statement.executeLargeUpdate(connection.translate(sql).sql); } @Override public final long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException { - return super.executeLargeUpdate(connection.translate(sql), autoGeneratedKeys); + return statement.executeLargeUpdate(connection.translate(sql).sql, autoGeneratedKeys); } @Override public final long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException { - return super.executeLargeUpdate(connection.translate(sql), columnIndexes); + return statement.executeLargeUpdate(connection.translate(sql).sql, columnIndexes); } @Override public final long executeLargeUpdate(String sql, String[] columnNames) throws SQLException { - return super.executeLargeUpdate(connection.translate(sql), columnNames); + return statement.executeLargeUpdate(connection.translate(sql).sql, columnNames); } @Override public final void addBatch(String sql) throws SQLException { - super.addBatch(connection.translate(sql)); + statement.addBatch(connection.translate(sql).sql); } @Override public final Connection getConnection() throws SQLException { return connection; } + + // ------------------------------------------------------------------------- + // XXX: Prepared statement execution + // ------------------------------------------------------------------------- + + private final PreparedStatement last() throws SQLException { + if (last == null) + throw new SQLException("No PreparedStatement is available yet"); + else + return last; + } + + private final PreparedStatement prepareAndBind() throws SQLException { + last = prepared.apply(binds.toArray(EMPTY_PARAM)); + + for (ThrowingConsumer flag : flags) + flag.accept(last); + + return last; + } + + @Override + public final ResultSet executeQuery() throws SQLException { + return prepareAndBind().executeQuery(); + } + + @Override + public final int executeUpdate() throws SQLException { + return prepareAndBind().executeUpdate(); + } + + @Override + public final boolean execute() throws SQLException { + return prepareAndBind().execute(); + } + + @Override + public final long executeLargeUpdate() throws SQLException { + return prepareAndBind().executeLargeUpdate(); + } + + // ------------------------------------------------------------------------- + // XXX: Lifecycle management + // ------------------------------------------------------------------------- + + @Override + public final void close() throws SQLException { + if (last != null) + last.close(); + else if (statement != null) + statement.close(); + } + + @Override + public final boolean isClosed() throws SQLException { + if (last != null) + return last.isClosed(); + else if (statement != null) + return statement.isClosed(); + else + return true; + } + + @Override + public final void cancel() throws SQLException { + statement().cancel(); + } + + // ------------------------------------------------------------------------- + // XXX: Result streaming + // ------------------------------------------------------------------------- + + @Override + public final ResultSet getResultSet() throws SQLException { + return last().getResultSet(); + } + + @Override + public final ResultSetMetaData getMetaData() throws SQLException { + return last().getMetaData(); + } + + @Override + public final int getUpdateCount() throws SQLException { + return last().getUpdateCount(); + } + + @Override + public final boolean getMoreResults() throws SQLException { + return last().getMoreResults(); + } + + @Override + public final boolean getMoreResults(int current) throws SQLException { + return last().getMoreResults(current); + } + + @Override + public final ResultSet getGeneratedKeys() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + // ------------------------------------------------------------------------- + // XXX: Indexed Variable binding for PreparedStatement + // ------------------------------------------------------------------------- + + private final void set(int parameterIndex, Supplier> supplier) { + bindValues(parameterIndex).set(parameterIndex - 1, supplier.get()); + } + + @Override + public final void setNull(int parameterIndex, int sqlType) throws SQLException { + // TODO: Type lookup + set(parameterIndex, () -> val((Object) null)); + } + + @Override + public final void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + // TODO: Type lookup + set(parameterIndex, () -> val((Object) null)); + } + + @Override + public final void setBoolean(int parameterIndex, boolean x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setByte(int parameterIndex, byte x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setShort(int parameterIndex, short x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setInt(int parameterIndex, int x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setLong(int parameterIndex, long x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setFloat(int parameterIndex, float x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setDouble(int parameterIndex, double x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setString(int parameterIndex, String x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setBytes(int parameterIndex, byte[] x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setDate(int parameterIndex, Date x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setTime(int parameterIndex, Time x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + // TODO: Type lookup + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setObject(int parameterIndex, Object x) throws SQLException { + // TODO: Type lookup + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + // TODO: Type lookup + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException { + // TODO: Type lookup + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setObject(int parameterIndex, Object x, SQLType targetSqlType) throws SQLException { + // TODO: Type lookup + set(parameterIndex, () -> val(x)); + } + + @Override + public final void setNString(int parameterIndex, String value) throws SQLException { + set(parameterIndex, () -> val(value, NVARCHAR)); + } + + // ------------------------------------------------------------------------- + // XXX: Indexed Variable binding (TODO) + // ------------------------------------------------------------------------- + + @Override + public final void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setRef(int parameterIndex, Ref x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBlob(int parameterIndex, Blob x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setClob(int parameterIndex, Clob x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setArray(int parameterIndex, Array x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setURL(int parameterIndex, URL x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNClob(int parameterIndex, NClob value) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setClob(int parameterIndex, Reader reader) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNClob(int parameterIndex, Reader reader) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + // ------------------------------------------------------------------------- + // XXX: Named Variable binding for CallableStatement + // ------------------------------------------------------------------------- + + // TODO: [#11512] What to do about these? + + @Override + public final void setURL(String parameterName, URL val) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNull(String parameterName, int sqlType) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBoolean(String parameterName, boolean x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setByte(String parameterName, byte x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setShort(String parameterName, short x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setInt(String parameterName, int x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setLong(String parameterName, long x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setFloat(String parameterName, float x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setDouble(String parameterName, double x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setString(String parameterName, String x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBytes(String parameterName, byte[] x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setDate(String parameterName, Date x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setTime(String parameterName, Time x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setTimestamp(String parameterName, Timestamp x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setObject(String parameterName, Object x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setRowId(String parameterName, RowId x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNString(String parameterName, String value) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNClob(String parameterName, NClob value) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setClob(String parameterName, Reader reader, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNClob(String parameterName, Reader reader, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBlob(String parameterName, Blob x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setClob(String parameterName, Clob x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setAsciiStream(String parameterName, InputStream x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBinaryStream(String parameterName, InputStream x) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setCharacterStream(String parameterName, Reader reader) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNCharacterStream(String parameterName, Reader value) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setClob(String parameterName, Reader reader) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setBlob(String parameterName, InputStream inputStream) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setNClob(String parameterName, Reader reader) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + // ------------------------------------------------------------------------- + // XXX: Other CallableStatement API + // ------------------------------------------------------------------------- + + // TODO: [#11512] What to do about these? + + + @Override + public final void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final boolean wasNull() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final String getString(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final boolean getBoolean(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final byte getByte(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final short getShort(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final int getInt(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final long getLong(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final float getFloat(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final double getDouble(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final byte[] getBytes(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Date getDate(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Time getTime(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Timestamp getTimestamp(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Object getObject(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Object getObject(int parameterIndex, Map> map) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Ref getRef(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Blob getBlob(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Clob getClob(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Array getArray(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Date getDate(int parameterIndex, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Time getTime(int parameterIndex, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(String parameterName, int sqlType) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final URL getURL(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final String getString(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final boolean getBoolean(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final byte getByte(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final short getShort(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final int getInt(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final long getLong(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final float getFloat(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final double getDouble(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final byte[] getBytes(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Date getDate(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Time getTime(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Timestamp getTimestamp(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Object getObject(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final BigDecimal getBigDecimal(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Object getObject(String parameterName, Map> map) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Ref getRef(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Blob getBlob(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Clob getClob(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Array getArray(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Date getDate(String parameterName, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Time getTime(String parameterName, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final URL getURL(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final RowId getRowId(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final RowId getRowId(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final NClob getNClob(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final NClob getNClob(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final SQLXML getSQLXML(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final SQLXML getSQLXML(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final String getNString(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final String getNString(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Reader getNCharacterStream(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Reader getNCharacterStream(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Reader getCharacterStream(int parameterIndex) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final Reader getCharacterStream(String parameterName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final T getObject(int parameterIndex, Class type) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final T getObject(String parameterName, Class type) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + // ------------------------------------------------------------------------- + // XXX: TODO + // ------------------------------------------------------------------------- + + @Override + public final void clearParameters() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void addBatch() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final ParameterMetaData getParameterMetaData() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final SQLWarning getWarnings() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void clearWarnings() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void clearBatch() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final int[] executeBatch() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final void closeOnCompletion() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final boolean isCloseOnCompletion() throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final T unwrap(Class iface) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } + + @Override + public final boolean isWrapperFor(Class iface) throws SQLException { + throw new SQLFeatureNotSupportedException(); + } } diff --git a/jOOQ/src/main/java/org/jooq/impl/RecordDelegate.java b/jOOQ/src/main/java/org/jooq/impl/RecordDelegate.java index ae3e705ec5..57815da455 100644 --- a/jOOQ/src/main/java/org/jooq/impl/RecordDelegate.java +++ b/jOOQ/src/main/java/org/jooq/impl/RecordDelegate.java @@ -92,7 +92,7 @@ final class RecordDelegate { } @SuppressWarnings("unchecked") - final R operate(RecordOperation operation) throws E { + final R operate(ThrowingFunction operation) throws E { R record = recordSupplier.get(); // [#3300] Records that were fetched from the database @@ -142,7 +142,7 @@ final class RecordDelegate { if (operation != null) { try { - operation.operate(record); + operation.apply(record); } // [#2770][#3036] Exceptions must not propagate before listeners receive "end" events diff --git a/jOOQ/src/main/java/org/jooq/impl/RecordOperation.java b/jOOQ/src/main/java/org/jooq/impl/RecordOperation.java deleted file mode 100644 index 96f263c442..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/RecordOperation.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Other licenses: - * ----------------------------------------------------------------------------- - * Commercial licenses for this work are available. These replace the above - * ASL 2.0 and offer limited warranties, support, maintenance, and commercial - * database integrations. - * - * For more information, please visit: http://www.jooq.org/licenses - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -package org.jooq.impl; - -import org.jooq.Record; -import org.jooq.RecordListener; - -/** - * An operation callback for {@link Record} objects, abstracting - * {@link RecordListener} lifecycle handling. - * - * @author Lukas Eder - */ -@FunctionalInterface -interface RecordOperation { - - /** - * Callback method to initialise a record. - */ - R operate(R record) throws E; -}