use of io.r2dbc.spi.Statement in project spring-framework by spring-projects.
the class DefaultDatabaseClientUnitTests method executeShouldBindNullValues.
@Test
void executeShouldBindNullValues() {
Statement statement = mockStatementFor("SELECT * FROM table WHERE key = $1");
DatabaseClient databaseClient = databaseClientBuilder.namedParameters(false).build();
databaseClient.sql("SELECT * FROM table WHERE key = $1").bindNull(0, String.class).then().as(StepVerifier::create).verifyComplete();
verify(statement).bindNull(0, String.class);
databaseClient.sql("SELECT * FROM table WHERE key = $1").bindNull("$1", String.class).then().as(StepVerifier::create).verifyComplete();
verify(statement).bindNull("$1", String.class);
}
use of io.r2dbc.spi.Statement in project spring-framework by spring-projects.
the class DefaultDatabaseClientUnitTests method shouldApplyExecuteFunction.
@Test
void shouldApplyExecuteFunction() {
Statement statement = mockStatement();
MockResult result = mockSingleColumnResult(MockRow.builder().identified(0, Object.class, "Walter"));
DatabaseClient databaseClient = databaseClientBuilder.executeFunction(stmnt -> Mono.just(result)).build();
databaseClient.sql("SELECT").fetch().all().as(StepVerifier::create).expectNextCount(1).verifyComplete();
verifyNoInteractions(statement);
}
Aggregations