We now ship our own SqlProvider variant to not require Spring JDBC as mandatory dependency. Spring JDBC can be provided optionally to use SQL-code based exception translation.
We now attempt to lookup ConnectionFactory from ApplicationContext and fall back to a local
method call if ConnectionFactory is not exposed as bean.
Original pull request: #96.
Clarified code a little.
Added a warning to `AnonymousBindMarkers`:
Anonymous bind markers are problematic because the have to appear in generated SQL in the same order they get generated.
This might cause challenges in the future with complex generate statements.
For example those containing subselects which limit the freedom of arranging bind markers.
Original pull request: #84.
We now support MySQL through the jasync-mysql driver that exposes its asynchronous functionality through a R2DBC wrapper implementation.
Jasync uses for now its own exceptions.
Original pull request: #84.
Anonymous indexed bind markers come with a static placeholder symbol for all parameter occurrences and they are bound by index.
Original pull request: #84.
SimpleR2dbcRepository.save(…) now falls back to the saved object as emitted result if the INSERT statement does not return generated keys.
Adding H2 database engine for tests to simulate such behavior.
Original pull request: #90.
MappingR2dbcConverter now considers custom conversions for inbound and outbound conversion of top-level types (Row to Entity, Entity to OutboundRow) and on property level (e.g. convert an object to String and vice versa).
Original pull request: #70.
All conversion functionality is now pulled together into MappingR2dbcConverter.
Introduce OutboundRow to provide mapping between column names and settable values. Remove identifier from SettableValue.
Original pull request: #62.
This commit introduces Coroutines support for `DatabaseClient`
functional API via Kotlin extensions that provide suspendable
functions prefixed by `await` for `Mono` based APIs.
Extensions for `Flux` will be added when Kotlin/kotlinx.coroutines#254
will be fixed.
It also provides `asType<Foo>()` extensions useful for Reactive API
as well.
Original pull request: #63.
Formatting.
Made Tests simpler and stricter by using `containsExactly`.
Added @Test annotation to ignored database specific tests so they actually show up as ignored.
Original pull request: #47.
DatabaseClient now supports named parameters prefixed with a colon such as :name in addition to database-native bind markers. Named parameters thus are supported in annotated repository query methods which also increases portability of queries across database vendors.
Named parameter support unrolls collection arguments to reduce the need for argument-specific SQL statements:
db.execute()
.sql("SELECT id, name, state FROM table WHERE age IN (:ages)")
.bind("ages", Arrays.asList(35, 50));
Results in a query: SELECT id, name, state FROM table WHERE age IN (35, 50)
Collection arguments containing nested object arrays can be used to use select lists:
List<Object[]> tuples = new ArrayList<>();
tuples.add(new Object[] {"John", 35});
tuples.add(new Object[] {"Ann", 50});
db.execute()
.sql("SELECT id, name, state FROM table WHERE (name, age) IN (:tuples)")
.bind("tuples", tuples);
translates to: SELECT id, name, state FROM table WHERE (name, age) IN (('John', 35), ('Ann', 50))
Original pull request: #47.
Postgres integration tests now run either with a locally installed and started database or if no such database can be found an instance gets started in a Docker container via Testcontainers.
We prefer a database based on TestContainers. Only if this can't be obtained do we try to access a local database for Postgres.
This minimizes the risk of accessing a database during tests that is not intended for that purpose.
If the system property `spring.data.r2dbc.test.preferLocalDatabase` is set to "true" the local database is preferred.
Original pull request: #51.
We now make sure to close connections only once by tracking the cleanup state. Flux.usingWhen/Mono.usingWhen do not ensure atomic cleanup in situations where the subscription completes and then the subscription is terminated.
This behavior has lead to closing a connection multiple times.
Related ticket: reactor/reactor-core#1486
Introduce ArrayColumns type to encapsulate Dialect-specific array support.
Apply array conversion for properties that do not match the native array type.
Add integration tests for Postgres array columns.
Original pull request: #31.