You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/asciidoc/reference/r2dbc-sql.adoc
+10-10
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,15 @@ The following example shows what you need to include for minimal but fully funct
6
6
7
7
[source,java]
8
8
----
9
-
Mono<Void> completion = client.sql("CREATE TABLE person (id VARCHAR(255) PRIMARY KEY, name VARCHAR(255), age INTEGER);")
9
+
Mono<Void> completion = client.execute("CREATE TABLE person (id VARCHAR(255) PRIMARY KEY, name VARCHAR(255), age INTEGER);")
10
10
.then();
11
11
----
12
12
13
13
`DatabaseClient` is designed for a convenient fluent usage.
14
14
It exposes intermediate, continuation, and terminal methods at each stage of the execution specification.
15
15
The example above uses `then()` to return a completion `Publisher` that completes as soon as the query (or queries, if the SQL query contains multiple statements) completes.
16
16
17
-
NOTE: `sql(…)` accepts either the SQL query string or a query `Supplier<String>` to defer the actual query creation until execution.
17
+
NOTE: `execute(…)` accepts either the SQL query string or a query `Supplier<String>` to defer the actual query creation until execution.
18
18
19
19
[[r2dbc.datbaseclient.queries]]
20
20
== Running Queries
@@ -26,7 +26,7 @@ The following example shows an `UPDATE` statement that returns the number of upd
26
26
27
27
[source,java]
28
28
----
29
-
Mono<Integer> affectedRows = client.sql("UPDATE person SET name = 'Joe'")
29
+
Mono<Integer> affectedRows = client.execute("UPDATE person SET name = 'Joe'")
30
30
.fetch().rowsUpdated();
31
31
----
32
32
@@ -36,7 +36,7 @@ You might have noticed the use of `fetch()` in the previous example.
36
36
37
37
[source,java]
38
38
----
39
-
Mono<Map<String, Object>> first = client.sql("SELECT id, name FROM person")
39
+
Mono<Map<String, Object>> first = client.execute("SELECT id, name FROM person")
40
40
.fetch().first();
41
41
----
42
42
@@ -52,7 +52,7 @@ You can consume data with the following operators:
52
52
53
53
[source,java]
54
54
----
55
-
Flux<Person> all = client.sql("SELECT id, name FROM mytable")
55
+
Flux<Person> all = client.execute("SELECT id, name FROM mytable")
56
56
.as(Person.class)
57
57
.fetch().all();
58
58
----
@@ -69,7 +69,7 @@ The following example extracts the `id` column and emits its value:
69
69
70
70
[source,java]
71
71
----
72
-
Flux<String> names = client.sql("SELECT name FROM person")
72
+
Flux<String> names = client.execute("SELECT name FROM person")
0 commit comments