Skip to content

Commit e13fcd7

Browse files
committed
#73 - hacking - changed method name according to review.
1 parent 565faf5 commit e13fcd7

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/main/java/org/springframework/data/r2dbc/function/DefaultDatabaseClient.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ <T> FetchSpec<T> exchange(String sql, BiFunction<Row, RowMetadata, T> mappingFun
340340
pop = new ParameterbindingPreparedOperation(sql, namedParameters, dataAccessStrategy, byName, byIndex);
341341
}
342342

343-
Function<Connection, Flux<Result>> resultFunction = it -> Flux.from(pop.bind(it).execute());
343+
Function<Connection, Flux<Result>> resultFunction = it -> Flux.from(pop.createBoundStatement(it).execute());
344344

345345
return new DefaultSqlResult<>(DefaultDatabaseClient.this, //
346346
sql, //
@@ -883,7 +883,7 @@ private <R> FetchSpec<R> exchange(BiFunction<Row, RowMetadata, R> mappingFunctio
883883
byName.forEach(it::bind);
884884
});
885885

886-
Function<Connection, Flux<Result>> resultFunction = it -> Flux.from(operation.bind(it).execute());
886+
Function<Connection, Flux<Result>> resultFunction = it -> Flux.from(operation.createBoundStatement(it).execute());
887887

888888
return new DefaultSqlResult<>(DefaultDatabaseClient.this, //
889889
operation.toQuery(), //
@@ -994,7 +994,7 @@ private <MR> FetchSpec<MR> exchange(Object toInsert, BiFunction<Row, RowMetadata
994994
});
995995
});
996996

997-
Function<Connection, Flux<Result>> resultFunction = it -> Flux.from(operation.bind(it).execute());
997+
Function<Connection, Flux<Result>> resultFunction = it -> Flux.from(operation.createBoundStatement(it).execute());
998998

999999
return new DefaultSqlResult<>(DefaultDatabaseClient.this, //
10001000
operation.toQuery(), //

src/main/java/org/springframework/data/r2dbc/function/DefaultStatementFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ protected Statement bind(Statement to) {
472472
}
473473

474474
@Override
475-
public Statement bind(Connection connection) {
475+
public Statement createBoundStatement(Connection connection) {
476476

477477
// TODO add back logging
478478
// if (logger.isDebugEnabled()) {

src/main/java/org/springframework/data/r2dbc/function/ParameterbindingPreparedOperation.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public BindableOperation getSource() {
5656
}
5757

5858
@Override
59-
public Statement bind(Connection connection) {
59+
public Statement createBoundStatement(Connection connection) {
6060

6161
Statement statement = connection.createStatement(operation.toQuery());
6262

src/main/java/org/springframework/data/r2dbc/function/PreparedOperation.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ public interface PreparedOperation<T> extends QueryOperation {
4545
* @param connection the {@link Connection} used for constructing a statement
4646
* @return the bound statement.
4747
*/
48-
Statement bind(Connection connection);
48+
Statement createBoundStatement(Connection connection);
4949
}

src/test/java/org/springframework/data/r2dbc/function/StatementFactoryUnitTests.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void shouldToQuerySimpleSelectWithoutBindings() {
6161
assertThat(select.getSource()).isInstanceOf(Select.class);
6262
assertThat(select.toQuery()).isEqualTo("SELECT foo.bar, foo.baz FROM foo");
6363

64-
select.bind(connectionMock);
64+
select.createBoundStatement(connectionMock);
6565

6666
verifyZeroInteractions(statementMock);
6767
}
@@ -76,7 +76,7 @@ public void shouldToQuerySimpleSelectWithSimpleFilter() {
7676
assertThat(select.getSource()).isInstanceOf(Select.class);
7777
assertThat(select.toQuery()).isEqualTo("SELECT foo.bar, foo.baz FROM foo WHERE foo.doe = $1");
7878

79-
select.bind(connectionMock);
79+
select.createBoundStatement(connectionMock);
8080

8181
verify(statementMock).bind(0, "John");
8282
verifyNoMoreInteractions(statementMock);
@@ -93,7 +93,7 @@ public void shouldToQuerySimpleSelectWithMultipleFilters() {
9393
assertThat(select.getSource()).isInstanceOf(Select.class);
9494
assertThat(select.toQuery()).isEqualTo("SELECT foo.bar, foo.baz FROM foo WHERE foo.doe = $1 AND foo.baz = $2");
9595

96-
select.bind(connectionMock);
96+
select.createBoundStatement(connectionMock);
9797

9898
verify(statementMock).bind(0, "John");
9999
verify(statementMock).bind(1, "Jake");
@@ -110,7 +110,7 @@ public void shouldToQuerySimpleSelectWithNullFilter() {
110110
assertThat(select.getSource()).isInstanceOf(Select.class);
111111
assertThat(select.toQuery()).isEqualTo("SELECT foo.bar, foo.baz FROM foo WHERE foo.doe IS NULL");
112112

113-
select.bind(connectionMock);
113+
select.createBoundStatement(connectionMock);
114114
verifyZeroInteractions(statementMock);
115115
}
116116

@@ -124,7 +124,7 @@ public void shouldToQuerySimpleSelectWithIterableFilter() {
124124
assertThat(select.getSource()).isInstanceOf(Select.class);
125125
assertThat(select.toQuery()).isEqualTo("SELECT foo.bar, foo.baz FROM foo WHERE foo.doe IN ($1, $2)");
126126

127-
select.bind(connectionMock);
127+
select.createBoundStatement(connectionMock);
128128
verify(statementMock).bind(0, "John");
129129
verify(statementMock).bind(1, "Jake");
130130
verifyNoMoreInteractions(statementMock);
@@ -147,7 +147,7 @@ public void shouldToQuerySimpleInsert() {
147147
assertThat(insert.getSource()).isInstanceOf(Insert.class);
148148
assertThat(insert.toQuery()).isEqualTo("INSERT INTO foo (bar) VALUES ($1)");
149149

150-
insert.bind(connectionMock);
150+
insert.createBoundStatement(connectionMock);
151151
verify(statementMock).bind(0, "Foo");
152152
verify(statementMock).returnGeneratedValues(any(String[].class));
153153
verifyNoMoreInteractions(statementMock);
@@ -170,7 +170,7 @@ public void shouldToQuerySimpleUpdate() {
170170
assertThat(update.getSource()).isInstanceOf(Update.class);
171171
assertThat(update.toQuery()).isEqualTo("UPDATE foo SET bar = $1");
172172

173-
update.bind(connectionMock);
173+
update.createBoundStatement(connectionMock);
174174
verify(statementMock).bind(0, "Foo");
175175
verifyNoMoreInteractions(statementMock);
176176
}
@@ -185,7 +185,7 @@ public void shouldToQueryNullUpdate() {
185185
assertThat(update.getSource()).isInstanceOf(Update.class);
186186
assertThat(update.toQuery()).isEqualTo("UPDATE foo SET bar = $1");
187187

188-
update.bind(connectionMock);
188+
update.createBoundStatement(connectionMock);
189189
verify(statementMock).bindNull(0, String.class);
190190

191191
verifyNoMoreInteractions(statementMock);
@@ -202,7 +202,7 @@ public void shouldToQueryUpdateWithFilter() {
202202
assertThat(update.getSource()).isInstanceOf(Update.class);
203203
assertThat(update.toQuery()).isEqualTo("UPDATE foo SET bar = $1 WHERE foo.baz = $2");
204204

205-
update.bind(connectionMock);
205+
update.createBoundStatement(connectionMock);
206206
verify(statementMock).bind(0, "Foo");
207207
verify(statementMock).bind(1, "Baz");
208208
verifyNoMoreInteractions(statementMock);
@@ -218,7 +218,7 @@ public void shouldToQuerySimpleDeleteWithSimpleFilter() {
218218
assertThat(delete.getSource()).isInstanceOf(Delete.class);
219219
assertThat(delete.toQuery()).isEqualTo("DELETE FROM foo WHERE foo.doe = $1");
220220

221-
delete.bind(connectionMock);
221+
delete.createBoundStatement(connectionMock);
222222
verify(statementMock).bind(0, "John");
223223
verifyNoMoreInteractions(statementMock);
224224
}
@@ -234,7 +234,7 @@ public void shouldToQuerySimpleDeleteWithMultipleFilters() {
234234
assertThat(delete.getSource()).isInstanceOf(Delete.class);
235235
assertThat(delete.toQuery()).isEqualTo("DELETE FROM foo WHERE foo.doe = $1 AND foo.baz = $2");
236236

237-
delete.bind(connectionMock);
237+
delete.createBoundStatement(connectionMock);
238238
verify(statementMock).bind(0, "John");
239239
verify(statementMock).bind(1, "Jake");
240240
verifyNoMoreInteractions(statementMock);
@@ -250,7 +250,7 @@ public void shouldToQuerySimpleDeleteWithNullFilter() {
250250
assertThat(delete.getSource()).isInstanceOf(Delete.class);
251251
assertThat(delete.toQuery()).isEqualTo("DELETE FROM foo WHERE foo.doe IS NULL");
252252

253-
delete.bind(connectionMock);
253+
delete.createBoundStatement(connectionMock);
254254
verifyZeroInteractions(statementMock);
255255
}
256256
}

0 commit comments

Comments
 (0)