public PreparedStatement setNull(final int index) { return set(index, Value.NULL); }
public PreparedStatement setBigDecimal(final BigDecimal value) { return setBigDecimal(nextIndex(), value); }
public PreparedStatement setBoolean(final Boolean value) { return setBoolean(nextIndex(), value); }
public PreparedStatement setByteArray(final byte[] value) { return setByteArray(nextIndex(), value); }
public PreparedStatement setInteger(final Integer value) { return setInteger(nextIndex(), value); }
@Test public void bigDecimal() throws CheckedFutureException { test(bigDecimalColumnTypes(), (ps, v) -> ps.setBigDecimal(v), Row::getBigDecimal, r -> BigDecimal.valueOf(r.nextInt(5), r.nextInt(5)), (a, b) -> assertEquals(a.compareTo(b), 0)); }
@Test public void byte_() throws CheckedFutureException { test(byteColumnTypes(), (ps, v) -> ps.setByte(v), Row::getByte, r -> (byte) r.nextInt()); }
@Test public void float_() throws CheckedFutureException { test(floatColumnTypes(), (ps, v) -> ps.setFloat(v), Row::getFloat, Random::nextFloat, (a, b) -> assertEquals(a.floatValue(), b.floatValue(), 0.001f)); }
@Test public void double_() throws CheckedFutureException { test(doubleColumnTypes(), (ps, v) -> ps.setDouble(v), Row::getDouble, Random::nextDouble); }
@Test public void _boolean() throws CheckedFutureException { test(booleanColumnTypes(), (ps, v) -> ps.setBoolean(v), Row::getBoolean, Random::nextBoolean); }
@Test public void integer() throws CheckedFutureException { test(integerColumnTypes(), (ps, v) -> ps.setInteger(v), Row::getInteger, Random::nextInt); }
@Test public void byteArray() throws CheckedFutureException { test(byteArrayColumnTypes(), (ps, v) -> ps.setByteArray(v), Row::getByteArray, r -> { // final byte[] bytes = new byte[r.nextInt(5)]; // r.nextBytes(bytes); // return bytes; return new byte[] { 111, 14, -5 }; }, (a, b) -> assertArrayEquals(a, b)); }
@Override public final PostgresPreparedStatement set(final int index, final Value<?> param) { return create(super.set(index, param)); } }