Skip to content
Permalink
Browse files
IGNITE-16427 Added indentations and fixes to codeblocks in aplha-4 do…
…cs. Fixes #615

Signed-off-by: Slava Koptilin <slava.koptilin@gmail.com>
  • Loading branch information
IgGusev authored and sk0x50 committed Feb 3, 2022
1 parent c4d3d82 commit e179bdcf1bbc59ea3cd098ab322dea789895e19f
Showing 2 changed files with 35 additions and 19 deletions.
@@ -26,21 +26,36 @@ See the examples below:
+
[source,text]
----
CREATE TABLE MyTable (id INT, val INT); -> creates PUBLIC.MYTABLE
ignite.tables().table("public.mytable"); -> returns PUBLIC.MYTABLE
CREATE TABLE \"MyTable\" (id INT, val INT); -> creates PUBLIC.MyTable
ignite.tables().table("public.\"MyTable\""); -> returns PUBLIC.MyTable
// Creates PUBLIC.MYTABLE.
CREATE TABLE MyTable (id INT, val INT);
// Returns PUBLIC.MYTABLE.
ignite.tables().table("public.mytable"); ->
// Creates PUBLIC.MyTable.
CREATE TABLE \"MyTable\" (id INT, val INT); ->
// Returns PUBLIC.MyTable.
ignite.tables().table("public.\"MyTable\""); ->
----
* Tuples or columns:
+
[source,text]
----
CREATE TABLE MyTable (id INT, \"Id\" INT, val INT); -> creates PUBLIC.MYTABLE (ID, Id, VAL)
// Creates PUBLIC.MYTABLE (ID, Id, VAL).
CREATE TABLE MyTable (id INT, \"Id\" INT, val INT);
Tuple tuple = ...
tuple.value("id") -> returns ID column's value
tuple.value("Id") -> returns ID column's value
tuple.value("\"Id\"") -> returns Id column's value
// Returns ID column's value.
tuple.value("id")
// Returns ID column's value.
tuple.value("Id")
// Returns Id column's value.
tuple.value("\"Id\"")
----
====
@@ -41,19 +41,20 @@ tab:Java[]
----
protected Table accounts;
protected Table customers;
accounts.recordView().upsert(null, makeValue(1, BALANCE_1));
accounts.recordView().upsert(null, makeValue(2, BALANCE_2));
igniteTransactions.beginAsync()
.thenCompose(tx -> accounts.recordView().getAsync(tx, makeKey(1))
.thenCombine(accounts.recordView().getAsync(tx, makeKey(2)), (v1, v2) -> new Pair<>(v1, v2))
.thenCompose(pair -> allOf(
accounts.recordView().upsertAsync(
tx, makeValue(1, pair.getFirst().doubleValue("balance") - DELTA)),
accounts.recordView().upsertAsync(
tx, makeValue(2, pair.getSecond().doubleValue("balance") + DELTA))
)
.thenApply(ignored -> tx)
)
).thenCompose(Transaction::commitAsync).join();
.thenCompose(tx -> accounts.recordView().getAsync(tx, makeKey(1))
.thenCombine(accounts.recordView().getAsync(tx, makeKey(2)), (v1, v2) -> new Pair<>(v1, v2))
.thenCompose(pair -> allOf(
accounts.recordView().upsertAsync(
tx, makeValue(1, pair.getFirst().doubleValue("balance") - DELTA)),
accounts.recordView().upsertAsync(
tx, makeValue(2, pair.getSecond().doubleValue("balance") + DELTA))
)
.thenApply(ignored -> tx)
)
).thenCompose(Transaction::commitAsync).join();
----
--

0 comments on commit e179bdc

Please sign in to comment.