17
17
18
18
import io .r2dbc .spi .Connection ;
19
19
import io .r2dbc .spi .Statement ;
20
- import org .springframework .data .r2dbc .domain .SettableValue ;
21
20
22
21
import java .util .Map ;
23
22
23
+ import org .springframework .data .r2dbc .domain .SettableValue ;
24
+
24
25
/**
25
26
* @author Jens Schauder
26
27
*/
27
- public class PrameterbindingPreparedOperation implements PreparedOperation <BindableOperation > {
28
+ public class ParameterbindingPreparedOperation implements PreparedOperation <BindableOperation > {
28
29
29
30
private final BindableOperation operation ;
30
31
private final Map <String , SettableValue > byName ;
31
32
private final Map <Integer , SettableValue > byIndex ;
32
33
33
- public PrameterbindingPreparedOperation (BindableOperation operation , Map <String , SettableValue > byName , Map <Integer , SettableValue > byIndex ) {
34
+ private ParameterbindingPreparedOperation (BindableOperation operation , Map <String , SettableValue > byName ,
35
+ Map <Integer , SettableValue > byIndex ) {
34
36
35
37
this .operation = operation ;
36
38
this .byName = byName ;
37
39
this .byIndex = byIndex ;
38
40
}
39
41
42
+ ParameterbindingPreparedOperation (String sql , NamedParameterExpander namedParameters ,
43
+ ReactiveDataAccessStrategy dataAccessStrategy , Map <String , SettableValue > byName ,
44
+ Map <Integer , SettableValue > byIndex ) {
45
+
46
+ this ( //
47
+ namedParameters .expand (sql , dataAccessStrategy .getBindMarkersFactory (), new MapBindParameterSource (byName )), //
48
+ byName , //
49
+ byIndex //
50
+ );
51
+ }
52
+
40
53
@ Override
41
54
public BindableOperation getSource () {
42
55
return operation ;
43
56
}
44
57
45
58
@ Override
46
59
public Statement bind (Statement to ) {
47
- return null ;
60
+ throw new UnsupportedOperationException ( "we don't do that here" ) ;
48
61
}
49
62
50
63
@ Override
@@ -63,15 +76,14 @@ public Statement bind(Connection connection) {
63
76
64
77
bindByIndex (statement , byIndex );
65
78
66
- return statement ; }
79
+ return statement ;
80
+ }
67
81
68
82
@ Override
69
83
public String toQuery () {
70
- return null ;
84
+ return operation . toQuery () ;
71
85
}
72
86
73
-
74
-
75
87
private static void bindByName (Statement statement , Map <String , SettableValue > byName ) {
76
88
77
89
byName .forEach ((name , o ) -> {
0 commit comments