@@ -254,6 +254,25 @@ Kotlin::
254
254
----
255
255
======
256
256
257
+ Alternatively, there is a shortcut for mapping to a single value:
258
+
259
+ [source,java]
260
+ ----
261
+ Flux<String> names = client.sql("SELECT name FROM person")
262
+ .mapValue(String.class)
263
+ .all();
264
+ ----
265
+
266
+ Or you may map to a result object with bean properties or record components:
267
+
268
+ [source,java]
269
+ ----
270
+ // assuming a name property on Person
271
+ Flux<Person> persons = client.sql("SELECT name FROM person")
272
+ .mapProperties(Person.class)
273
+ .all();
274
+ ----
275
+
257
276
[[r2dbc-DatabaseClient-mapping-null]]
258
277
.What about `null`?
259
278
****
@@ -324,6 +343,27 @@ The following example shows parameter binding for a query:
324
343
.bind("age", 34);
325
344
----
326
345
346
+ Alternatively, you may pass in a map of names and values:
347
+
348
+ [source,java]
349
+ ----
350
+ Map<String, Object> params = new LinkedHashMap<>();
351
+ params.put("id", "joe");
352
+ params.put("name", "Joe");
353
+ params.put("age", 34);
354
+ db.sql("INSERT INTO person (id, name, age) VALUES(:id, :name, :age)")
355
+ .bindValues(params);
356
+ ----
357
+
358
+ Or you may pass in a parameter object with bean properties or record components:
359
+
360
+ [source,java]
361
+ ----
362
+ // assuming id, name, age properties on Person
363
+ db.sql("INSERT INTO person (id, name, age) VALUES(:id, :name, :age)")
364
+ .bindProperties(new Person("joe", "Joe", 34);
365
+ ----
366
+
327
367
.R2DBC Native Bind Markers
328
368
****
329
369
R2DBC uses database-native bind markers that depend on the actual database vendor.
0 commit comments