use of io.vertx.sqlclient.ColumnChecker in project vertx-sql-client by eclipse-vertx.
the class MSSQLPreparedQueryNullableDataTypeTest method testEncodeBitValue.
private void testEncodeBitValue(TestContext ctx, Boolean value) {
testPreparedQueryEncodeGeneric(ctx, "nullable_datatype", "test_boolean", value, row -> {
ColumnChecker checker = ColumnChecker.checkColumn(0, "test_boolean");
if (value == null) {
checker.returnsNull();
} else {
checker.returns(Tuple::getValue, Row::getValue, value).returns(Tuple::getBoolean, Row::getBoolean, value).returns(Boolean.class, value);
}
checker.forRow(row);
});
}
use of io.vertx.sqlclient.ColumnChecker in project vertx-sql-client by eclipse-vertx.
the class MSSQLPreparedQueryNullableDataTypeTest method testEncodeBufferValue.
private void testEncodeBufferValue(TestContext ctx, String columnName, Object value, Object expected) {
Object param = value == null ? NullValue.Buffer : value;
testPreparedQueryEncodeGeneric(ctx, "nullable_datatype", columnName, param, row -> {
ColumnChecker checker = ColumnChecker.checkColumn(0, columnName);
if (value == null || value instanceof NullValue) {
checker.returnsNull();
} else {
checker.returns(Tuple::getValue, Row::getValue, expected).returns(Tuple::getBuffer, Row::getBuffer, expected).returns(Buffer.class, (Buffer) expected).forRow(row);
}
});
}
use of io.vertx.sqlclient.ColumnChecker in project vertx-sql-client by eclipse-vertx.
the class MSSQLPreparedQueryNullableDataTypeTest method testEncodeTimeValue.
private void testEncodeTimeValue(TestContext ctx, LocalTime value) {
testPreparedQueryEncodeGeneric(ctx, "nullable_datatype", "test_time", value, row -> {
ColumnChecker checker = ColumnChecker.checkColumn(0, "test_time");
if (value == null) {
checker.returnsNull();
} else {
checker.returns(Tuple::getValue, Row::getValue, value).returns(Tuple::getLocalTime, Row::getLocalTime, value).returns(LocalTime.class, value);
}
checker.forRow(row);
});
}
use of io.vertx.sqlclient.ColumnChecker in project vertx-sql-client by eclipse-vertx.
the class MSSQLPreparedQueryNullableDataTypeTest method testEncodeDateValue.
private void testEncodeDateValue(TestContext ctx, LocalDate value) {
testPreparedQueryEncodeGeneric(ctx, "nullable_datatype", "test_date", value, row -> {
ColumnChecker checker = ColumnChecker.checkColumn(0, "test_date");
if (value == null) {
checker.returnsNull();
} else {
checker.returns(Tuple::getValue, Row::getValue, value).returns(Tuple::getLocalDate, Row::getLocalDate, value).returns(LocalDate.class, value);
}
checker.forRow(row);
});
}
use of io.vertx.sqlclient.ColumnChecker in project vertx-sql-client by eclipse-vertx.
the class DateTimeTypesExtendedCodecTest method testDecodeTimestampTzMinusInfinity.
@Test
public void testDecodeTimestampTzMinusInfinity(TestContext ctx) {
OffsetDateTime expected = OffsetDateTime.MIN;
ColumnChecker checker = ColumnChecker.checkColumn(0, "TimestampTz").returns(Tuple::getValue, Row::getValue, expected).returns(Tuple::getOffsetTime, Row::getOffsetTime, expected.toOffsetTime()).returns(Tuple::getOffsetDateTime, Row::getOffsetDateTime, expected).returns(Tuple::getLocalDate, Row::getLocalDate, expected.toLocalDate()).returns(Tuple::getLocalTime, Row::getLocalTime, expected.toLocalTime()).returns(Tuple::getLocalDateTime, Row::getLocalDateTime, expected.toLocalDateTime()).returns(Tuple::getTemporal, Row::getTemporal, expected);
testDecodeDataTimeGeneric(ctx, "TIMESTAMP WITH TIME ZONE", "TimestampTz", checker, expected);
}
Aggregations