Skip to content

Commit fa55f0e

Browse files
committed
#73 - hacking - moved bindings in constructor.
1 parent 13690ea commit fa55f0e

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

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

+18-7
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,18 @@ static abstract class PreparedOperationSupport<T> implements PreparedOperation<T
440440

441441
private Function<String, String> sqlFilter = s -> s;
442442
private Function<Bindings, Bindings> bindingFilter = b -> b;
443+
private final Bindings bindings;
444+
445+
protected PreparedOperationSupport(Bindings bindings) {
446+
447+
this.bindings = bindings;
448+
}
443449

444450
abstract protected String createBaseSql();
445451

446-
protected abstract Bindings getBaseBinding();
452+
Bindings getBaseBinding() {
453+
return bindings;
454+
};
447455

448456
/*
449457
* (non-Javadoc)
@@ -500,12 +508,18 @@ public void addBindingFilter(Function<Bindings, Bindings> filter) {
500508
*
501509
* @param <T>
502510
*/
503-
@RequiredArgsConstructor
504511
static class DefaultPreparedOperation<T> extends PreparedOperationSupport<T> {
505512

506513
private final T source;
507514
private final RenderContext renderContext;
508-
private final Bindings bindings;
515+
516+
DefaultPreparedOperation(T source, RenderContext renderContext, Bindings bindings) {
517+
518+
super(bindings);
519+
520+
this.source = source;
521+
this.renderContext = renderContext;
522+
}
509523

510524
/*
511525
* (non-Javadoc)
@@ -518,6 +532,7 @@ public T getSource() {
518532

519533
@Override
520534
protected String createBaseSql() {
535+
521536
SqlRenderer sqlRenderer = SqlRenderer.create(renderContext);
522537

523538
if (this.source instanceof Select) {
@@ -539,9 +554,5 @@ protected String createBaseSql() {
539554
throw new IllegalStateException("Cannot render " + this.getSource());
540555
}
541556

542-
@Override
543-
protected Bindings getBaseBinding() {
544-
return bindings;
545-
}
546557
}
547558
}

0 commit comments

Comments
 (0)