Refactoring rxjava-jdbc
This commit is contained in:
parent
a4d1a8909c
commit
5253362653
@ -20,17 +20,18 @@ public class TransactionTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCommitTransaction_thenRecordUpdated() {
|
public void whenCommitTransaction_thenRecordUpdated() {
|
||||||
begin = db.beginTransaction();
|
Observable<Boolean> begin = db.beginTransaction();
|
||||||
createStatement = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))")
|
Observable<Integer> createStatement = db
|
||||||
|
.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))")
|
||||||
.dependsOn(begin)
|
.dependsOn(begin)
|
||||||
.count();
|
.count();
|
||||||
insertStatement = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(1, 'John')")
|
Observable<Integer> insertStatement = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(1, 'John')")
|
||||||
.dependsOn(createStatement)
|
.dependsOn(createStatement)
|
||||||
.count();
|
.count();
|
||||||
updateStatement = db.update("UPDATE EMPLOYEE SET name = 'Tom' WHERE id = 1")
|
Observable<Integer> updateStatement = db.update("UPDATE EMPLOYEE SET name = 'Tom' WHERE id = 1")
|
||||||
.dependsOn(insertStatement)
|
.dependsOn(insertStatement)
|
||||||
.count();
|
.count();
|
||||||
commit = db.commit(updateStatement);
|
Observable<Boolean> commit = db.commit(updateStatement);
|
||||||
String name = db.select("select name from EMPLOYEE WHERE id = 1")
|
String name = db.select("select name from EMPLOYEE WHERE id = 1")
|
||||||
.dependsOn(commit)
|
.dependsOn(commit)
|
||||||
.getAs(String.class)
|
.getAs(String.class)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user