[#1638] Deprecate ArrayRecord.createArray()

This commit is contained in:
Lukas Eder 2012-07-27 18:48:44 +02:00
parent edcdb41adc
commit c2fb28f04c
3 changed files with 10 additions and 1 deletions

View File

@ -100,6 +100,8 @@ public interface ArrayRecord<E> extends Store<E>, Iterable<E> {
* JDBC {@link Array}
* @throws DetachedException If this method is called on a detached
* <code>ArrayRecord</code>
* @deprecated - 2.5.0 [#1638] - Do not reuse this method
*/
@Deprecated
Array createArray() throws SQLException, DetachedException;
}

View File

@ -223,6 +223,7 @@ public class ArrayRecordImpl<T> extends AbstractStore<T> implements ArrayRecord<
}
@Override
@Deprecated
public final java.sql.Array createArray() throws SQLException {
SQLDialect dialect = getConfiguration().getDialect();

View File

@ -40,12 +40,16 @@ import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.SQLDialect.SQLITE;
import static org.jooq.SQLDialect.SQLSERVER;
import static org.jooq.SQLDialect.SYBASE;
import static org.jooq.impl.Util.getDriverConnection;
import static org.jooq.tools.reflect.Reflect.on;
import static org.jooq.util.postgres.PostgresUtils.toPGInterval;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@ -314,7 +318,9 @@ class DefaultBindContext extends AbstractBindContext {
}
}
else if (ArrayRecord.class.isAssignableFrom(type)) {
stmt.setArray(nextIndex(), ((ArrayRecord<?>) value).createArray());
Connection connection = getDriverConnection(this);
ArrayRecord<?> arrayRecord = (ArrayRecord<?>) value;
stmt.setArray(nextIndex(), on(connection).call("createARRAY", arrayRecord.getName(), arrayRecord.get()).<Array>get());
}
else if (EnumType.class.isAssignableFrom(type)) {
stmt.setString(nextIndex(), ((EnumType) value).getLiteral());