Skip to content

Commit 432b885

Browse files
committed
#54 - Build against R2DBC 1.0 snapshots.
1 parent 3a5278c commit 432b885

21 files changed

+66
-106
lines changed

pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
<hsqldb.version>2.4.1</hsqldb.version>
3232
<postgresql.version>42.2.5</postgresql.version>
3333
<mssql-jdbc.version>7.1.2.jre8-preview</mssql-jdbc.version>
34-
<r2dbc-spi.version>1.0.0.M6</r2dbc-spi.version>
35-
<r2dbc-postgresql.version>1.0.0.M6</r2dbc-postgresql.version>
36-
<r2dbc-h2.version>1.0.0.M6</r2dbc-h2.version>
37-
<r2dbc-mssql.version>1.0.0.M6</r2dbc-mssql.version>
34+
<r2dbc.version>1.0.0.BUILD-SNAPSHOT</r2dbc.version>
35+
<r2dbc-spi.version>${r2dbc.version}</r2dbc-spi.version>
36+
<r2dbc-postgresql.version>${r2dbc.version}</r2dbc-postgresql.version>
37+
<r2dbc-h2.version>${r2dbc.version}</r2dbc-h2.version>
38+
<r2dbc-mssql.version>${r2dbc.version}</r2dbc-mssql.version>
3839
<reactive-streams.version>1.0.1</reactive-streams.version>
3940
<testcontainers.version>1.10.1</testcontainers.version>
4041

src/main/java/org/springframework/data/r2dbc/dialect/BindMarker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public interface BindMarker {
2828
* {@literal null} values.
2929
* @see Statement#bind
3030
*/
31-
void bind(Statement<?> statement, Object value);
31+
void bind(Statement statement, Object value);
3232

3333
/**
3434
* Bind a {@literal null} value to the {@link Statement} using the underlying binding strategy.
@@ -37,5 +37,5 @@ public interface BindMarker {
3737
* @param valueType value type, must not be {@literal null}.
3838
* @see Statement#bindNull
3939
*/
40-
void bindNull(Statement<?> statement, Class<?> valueType);
40+
void bindNull(Statement statement, Class<?> valueType);
4141
}

src/main/java/org/springframework/data/r2dbc/dialect/Dialect.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@ public interface Dialect {
2222
*/
2323
BindMarkersFactory getBindMarkersFactory();
2424

25-
/**
26-
* Returns the clause to include for returning generated keys. The returned query is directly appended to
27-
* {@code INSERT} statements.
28-
*
29-
* @return the clause to include for returning generated keys.
30-
* @deprecated to be removed after upgrading to R2DBC 1.0M7 in favor of using the driver's direct support for
31-
* retrieving generated keys.
32-
*/
33-
@Deprecated
34-
String generatedKeysClause();
35-
3625
/**
3726
* Return a collection of types that are natively supported by this database/driver. Defaults to
3827
* {@link Collections#emptySet()}.

src/main/java/org/springframework/data/r2dbc/dialect/H2Dialect.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,4 @@ public class H2Dialect extends PostgresDialect {
1111
* Singleton instance.
1212
*/
1313
public static final H2Dialect INSTANCE = new H2Dialect();
14-
15-
/*
16-
* (non-Javadoc)
17-
* @see org.springframework.data.r2dbc.dialect.Dialect#returnGeneratedKeys()
18-
*/
19-
@Override
20-
public String generatedKeysClause() {
21-
return "";
22-
}
2314
}

src/main/java/org/springframework/data/r2dbc/dialect/IndexedBindMarkers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public String getPlaceholder() {
7474
* @see org.springframework.data.r2dbc.dialect.BindMarker#bindValue(io.r2dbc.spi.Statement, java.lang.Object)
7575
*/
7676
@Override
77-
public void bind(Statement<?> statement, Object value) {
77+
public void bind(Statement statement, Object value) {
7878
statement.bind(this.index, value);
7979
}
8080

@@ -83,7 +83,7 @@ public void bind(Statement<?> statement, Object value) {
8383
* @see org.springframework.data.r2dbc.dialect.BindMarker#bindNull(io.r2dbc.spi.Statement, java.lang.Class)
8484
*/
8585
@Override
86-
public void bindNull(Statement<?> statement, Class<?> valueType) {
86+
public void bindNull(Statement statement, Class<?> valueType) {
8787
statement.bindNull(this.index, valueType);
8888
}
8989
}

src/main/java/org/springframework/data/r2dbc/dialect/NamedBindMarkers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public String getPlaceholder() {
101101
* @see org.springframework.data.r2dbc.dialect.BindMarker#bindValue(io.r2dbc.spi.Statement, java.lang.Object)
102102
*/
103103
@Override
104-
public void bind(Statement<?> statement, Object value) {
104+
public void bind(Statement statement, Object value) {
105105
statement.bind(this.identifier, value);
106106
}
107107

@@ -110,7 +110,7 @@ public void bind(Statement<?> statement, Object value) {
110110
* @see org.springframework.data.r2dbc.dialect.BindMarker#bindNull(io.r2dbc.spi.Statement, java.lang.Class)
111111
*/
112112
@Override
113-
public void bindNull(Statement<?> statement, Class<?> valueType) {
113+
public void bindNull(Statement statement, Class<?> valueType) {
114114
statement.bindNull(this.identifier, valueType);
115115
}
116116
}

src/main/java/org/springframework/data/r2dbc/dialect/PostgresDialect.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,6 @@ public BindMarkersFactory getBindMarkersFactory() {
7373
return INDEXED;
7474
}
7575

76-
/*
77-
* (non-Javadoc)
78-
* @see org.springframework.data.r2dbc.dialect.Dialect#returnGeneratedKeys()
79-
*/
80-
@Override
81-
public String generatedKeysClause() {
82-
return "RETURNING *";
83-
}
84-
8576
/*
8677
* (non-Javadoc)
8778
* @see org.springframework.data.r2dbc.dialect.Dialect#getSimpleTypesKeys()

src/main/java/org/springframework/data/r2dbc/dialect/SqlServerDialect.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ public BindMarkersFactory getBindMarkersFactory() {
6262
return NAMED;
6363
}
6464

65-
/*
66-
* (non-Javadoc)
67-
* @see org.springframework.data.r2dbc.dialect.Dialect#returnGeneratedKeys()
68-
*/
69-
@Override
70-
public String generatedKeysClause() {
71-
return "select SCOPE_IDENTITY() AS GENERATED_KEYS";
72-
}
73-
7465
/*
7566
* (non-Javadoc)
7667
* @see org.springframework.data.r2dbc.dialect.Dialect#getSimpleTypesKeys()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface BindIdOperation extends BindableOperation {
1919
* @param value the actual value. Must not be {@literal null}.
2020
* @see Statement#bind
2121
*/
22-
void bindId(Statement<?> statement, Object value);
22+
void bindId(Statement statement, Object value);
2323

2424
/**
2525
* Bind the given {@code values} to the {@link Statement} using the underlying binding strategy.
@@ -28,5 +28,5 @@ public interface BindIdOperation extends BindableOperation {
2828
* @param values the actual values.
2929
* @see Statement#bind
3030
*/
31-
void bindIds(Statement<?> statement, Iterable<? extends Object> values);
31+
void bindIds(Statement statement, Iterable<? extends Object> values);
3232
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface BindableOperation extends QueryOperation {
2424
* {@literal null} values.
2525
* @see Statement#bind
2626
*/
27-
void bind(Statement<?> statement, String identifier, Object value);
27+
void bind(Statement statement, String identifier, Object value);
2828

2929
/**
3030
* Bind a {@literal null} value to the {@link Statement} using the underlying binding strategy.
@@ -34,7 +34,7 @@ public interface BindableOperation extends QueryOperation {
3434
* @param valueType value type, must not be {@literal null}.
3535
* @see Statement#bindNull
3636
*/
37-
void bindNull(Statement<?> statement, String identifier, Class<?> valueType);
37+
void bindNull(Statement statement, String identifier, Class<?> valueType);
3838

3939
/**
4040
* Bind a {@link SettableValue} to the {@link Statement} using the underlying binding strategy. Binds either the
@@ -45,7 +45,7 @@ public interface BindableOperation extends QueryOperation {
4545
* @see Statement#bind
4646
* @see Statement#bindNull
4747
*/
48-
default void bind(Statement<?> statement, SettableValue value) {
48+
default void bind(Statement statement, SettableValue value) {
4949

5050
if (value.getValue() == null) {
5151
bindNull(statement, value.getIdentifier().toString(), value.getType());

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ protected DefaultGenericExecuteSpec createGenericExecuteSpec(Supplier<String> sq
251251
return new DefaultGenericExecuteSpec(sqlSupplier);
252252
}
253253

254-
private static void doBind(Statement<?> statement, Map<String, SettableValue> byName,
254+
private static void doBind(Statement statement, Map<String, SettableValue> byName,
255255
Map<Integer, SettableValue> byIndex) {
256256

257257
bindByIndex(statement, byIndex);
258258
bindByName(statement, byName);
259259
}
260260

261-
private static void bindByName(Statement<?> statement, Map<String, SettableValue> byName) {
261+
private static void bindByName(Statement statement, Map<String, SettableValue> byName) {
262262

263263
byName.forEach((name, o) -> {
264264

@@ -270,7 +270,7 @@ private static void bindByName(Statement<?> statement, Map<String, SettableValue
270270
});
271271
}
272272

273-
private static void bindByIndex(Statement<?> statement, Map<Integer, SettableValue> byIndex) {
273+
private static void bindByIndex(Statement statement, Map<Integer, SettableValue> byIndex) {
274274

275275
byIndex.forEach((i, o) -> {
276276

@@ -329,7 +329,7 @@ protected String getSql() {
329329

330330
<T> FetchSpec<T> exchange(String sql, BiFunction<Row, RowMetadata, T> mappingFunction) {
331331

332-
Function<Connection, Statement<?>> executeFunction = it -> {
332+
Function<Connection, Statement> executeFunction = it -> {
333333

334334
if (logger.isDebugEnabled()) {
335335
logger.debug("Executing SQL statement [" + sql + "]");
@@ -338,7 +338,7 @@ <T> FetchSpec<T> exchange(String sql, BiFunction<Row, RowMetadata, T> mappingFun
338338
BindableOperation operation = namedParameters.expand(sql, dataAccessStrategy.getBindMarkersFactory(),
339339
new MapBindParameterSource(byName));
340340

341-
Statement<?> statement = it.createStatement(operation.toQuery());
341+
Statement statement = it.createStatement(operation.toQuery());
342342

343343
byName.forEach((name, o) -> {
344344

@@ -632,7 +632,7 @@ public DefaultSelectSpecSupport page(Pageable page) {
632632

633633
<R> FetchSpec<R> execute(String sql, BiFunction<Row, RowMetadata, R> mappingFunction) {
634634

635-
Function<Connection, Statement<?>> selectFunction = it -> {
635+
Function<Connection, Statement> selectFunction = it -> {
636636

637637
if (logger.isDebugEnabled()) {
638638
logger.debug("Executing SQL statement [" + sql + "]");
@@ -886,13 +886,13 @@ private <R> FetchSpec<R> exchange(BiFunction<Row, RowMetadata, R> mappingFunctio
886886
BindableOperation bindableInsert = dataAccessStrategy.insertAndReturnGeneratedKeys(table, byName.keySet());
887887

888888
String sql = bindableInsert.toQuery();
889-
Function<Connection, Statement<?>> insertFunction = it -> {
889+
Function<Connection, Statement> insertFunction = it -> {
890890

891891
if (logger.isDebugEnabled()) {
892892
logger.debug("Executing SQL statement [" + sql + "]");
893893
}
894894

895-
Statement<?> statement = it.createStatement(sql);
895+
Statement statement = it.createStatement(sql).returnGeneratedValues();
896896

897897
byName.forEach((k, v) -> bindableInsert.bind(statement, v));
898898

@@ -1015,7 +1015,7 @@ private <MR> FetchSpec<MR> exchange(Object toInsert, BiFunction<Row, RowMetadata
10151015
logger.debug("Executing SQL statement [" + sql + "]");
10161016
}
10171017

1018-
Statement<?> statement = it.createStatement(sql);
1018+
Statement statement = it.createStatement(sql).returnGeneratedValues();
10191019

10201020
for (SettableValue settable : insertValues) {
10211021
bindableInsert.bind(statement, settable);

0 commit comments

Comments
 (0)