Skip to content

Commit 01d114d

Browse files
committed
#73 - hacking - proper expanded single binding.
1 parent dcdd968 commit 01d114d

File tree

1 file changed

+10
-28
lines changed
  • src/main/java/org/springframework/data/r2dbc/function

1 file changed

+10
-28
lines changed

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

+10-28
Original file line numberDiff line numberDiff line change
@@ -94,46 +94,28 @@ public boolean isIndexed() {
9494

9595
public static class NamedExpandedSingleBinding<T> extends SingleBinding<T>{
9696

97-
public NamedExpandedSingleBinding(T identifier, SettableValue value) {
98-
super(identifier, value);
99-
}
100-
101-
@Override
102-
public void bindTo(Statement statement) {
103-
104-
if (getValue().isEmpty()) {
105-
statement.bindNull(getIdentifier(), getValue().getType());
106-
}
107-
108-
statement.bind(getIdentifier(), getValue());
109-
}
110-
111-
@Override
112-
public boolean isIndexed() {
113-
return false;
114-
}
115-
}
97+
private final BindableOperation operation;
11698

117-
public static class IndexedExpandedSingleBinding extends SingleBinding<Integer>{
99+
public NamedExpandedSingleBinding(T identifier, SettableValue value, BindableOperation operation) {
118100

119-
public IndexedExpandedSingleBinding(Integer identifier, SettableValue value) {
120101
super(identifier, value);
102+
103+
this.operation = operation;
121104
}
122105

123106
@Override
124107
public void bindTo(Statement statement) {
125108

126-
if (getValue().isEmpty()) {
127-
statement.bindNull((int)getIdentifier(), getValue().getType());
109+
if (getValue() != null) {
110+
operation.bind(statement,getIdentifier(), getValue());
111+
} else {
112+
operation.bindNull(statement, getIdentifier(), getValue().getType());
128113
}
129-
130-
statement.bind((int)getIdentifier(), getValue());
131114
}
115+
132116
@Override
133117
public boolean isIndexed() {
134-
return true;
118+
return false;
135119
}
136120
}
137-
138-
139121
}

0 commit comments

Comments
 (0)