本文整理了Java中io.vertx.ext.sql.SQLConnection.commit()
方法的一些代码示例,展示了SQLConnection.commit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLConnection.commit()
方法的具体详情如下:
包路径:io.vertx.ext.sql.SQLConnection
类名称:SQLConnection
方法名:commit
[英]Commits all changes made since the previous commit/rollback.
[中]提交自上次提交/回滚以来所做的所有更改。
代码示例来源:origin: vert-x3/vertx-examples
private void endTx(SQLConnection conn, Handler<ResultSet> done) {
conn.commit(res -> {
if (res.failed()) {
throw new RuntimeException(res.cause());
}
done.handle(null);
});
}
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Commits all changes made since the previous commit/rollback.
* @param handler the handler called when this operation completes.
* @return
*/
public io.vertx.rxjava.ext.sql.SQLConnection commit(Handler<AsyncResult<Void>> handler) {
delegate.commit(handler);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Commits all changes made since the previous commit/rollback.
* @param handler the handler called when this operation completes.
* @return
*/
public io.vertx.rxjava.ext.sql.SQLConnection commit(Handler<AsyncResult<Void>> handler) {
delegate.commit(handler);
return this;
}
代码示例来源:origin: com.jporm/jpo-rx-vertx3
@Override
public CompletableFuture<Void> commit() {
LOGGER.debug("Connection [{}] - commit", connectionNumber);
CompletableFuture<Void> result = new CompletableFuture<>();
connection.commit(handler -> {
if (handler.succeeded()) {
result.complete(null);
} else {
result.completeExceptionally(handler.cause());
}
});
return result;
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Override
public SQLConnection commit(Handler<AsyncResult<Void>> handler) {
delegate.commit(handler);
return this;
}
代码示例来源:origin: apiman/apiman
@Override
public void commit(IAsyncResultHandler<Void> handler) {
connection.commit(translateVoidHandlers(handler));
}
代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client
@Test
public void testTwoTransactionsAfterEachOther(TestContext context) {
Async async = context.async();
client.getConnection(ar -> {
if (ar.failed()) {
context.fail(ar.cause());
return;
}
conn = ar.result();
conn.setAutoCommit(false, ar2 -> {
ensureSuccess(context, ar2);
conn.query("SELECT 1", ar3 -> {
ensureSuccess(context, ar3);
conn.commit(ar4 -> {
ensureSuccess(context, ar4);
conn.query("SELECT 2", ar5 -> {
ensureSuccess(context, ar5);
conn.commit(ar6 -> {
ensureSuccess(context, ar6);
conn.setAutoCommit(true, ar7 -> {
ensureSuccess(context, ar7);
async.complete();
});
});
});
});
});
});
});
}
代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client
@Test
public void testTwoTransactionsAfterEachOther(TestContext context) {
Async async = context.async();
client.getConnection(ar -> {
if (ar.failed()) {
context.fail(ar.cause());
return;
}
conn = ar.result();
conn.setAutoCommit(false, ar2 -> {
ensureSuccess(context, ar2);
conn.query("SELECT 1", ar3 -> {
ensureSuccess(context, ar3);
conn.commit(ar4 -> {
ensureSuccess(context, ar4);
conn.query("SELECT 2", ar5 -> {
ensureSuccess(context, ar5);
conn.commit(ar6 -> {
ensureSuccess(context, ar6);
conn.setAutoCommit(true, ar7 -> {
ensureSuccess(context, ar7);
async.complete();
});
});
});
});
});
});
});
}
代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client
@Test
public void testEmptyTransactions(TestContext context) {
Async async = context.async();
client.getConnection(ar -> {
if (ar.failed()) {
context.fail(ar.cause());
return;
}
conn = ar.result();
conn.setAutoCommit(false, ar2 -> {
ensureSuccess(context, ar2);
conn.rollback(ar3 -> {
ensureSuccess(context, ar3);
conn.commit(ar4 -> {
ensureSuccess(context, ar4);
conn.setAutoCommit(true, ar5 -> {
ensureSuccess(context, ar5);
async.complete();
});
});
});
});
});
}
代码示例来源:origin: io.vertx/vertx-mysql-postgresql-client-jasync
@Test
public void testTwoTransactionsAfterEachOther(TestContext context) {
Async async = context.async();
client.getConnection(ar -> {
if (ar.failed()) {
context.fail(ar.cause());
return;
}
conn = ar.result();
conn.setAutoCommit(false, ar2 -> {
ensureSuccess(context, ar2);
conn.query("SELECT 1", ar3 -> {
ensureSuccess(context, ar3);
conn.commit(ar4 -> {
ensureSuccess(context, ar4);
conn.query("SELECT 2", ar5 -> {
ensureSuccess(context, ar5);
conn.commit(ar6 -> {
ensureSuccess(context, ar6);
conn.setAutoCommit(true, ar7 -> {
ensureSuccess(context, ar7);
async.complete();
});
});
});
});
});
});
});
}
代码示例来源:origin: io.vertx/vertx-mysql-postgresql-client-jasync
@Test
public void testEmptyTransactions(TestContext context) {
Async async = context.async();
client.getConnection(ar -> {
if (ar.failed()) {
context.fail(ar.cause());
return;
}
conn = ar.result();
conn.setAutoCommit(false, ar2 -> {
ensureSuccess(context, ar2);
conn.rollback(ar3 -> {
ensureSuccess(context, ar3);
conn.commit(ar4 -> {
ensureSuccess(context, ar4);
conn.setAutoCommit(true, ar5 -> {
ensureSuccess(context, ar5);
async.complete();
});
});
});
});
});
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Test
public void testWorkerPerConnection() {
int numConns = 4;
ArrayList<SQLConnection> conns = new ArrayList<>();
for (int i = 0; i < numConns; i++) {
conns.add(connection());
}
AtomicInteger count = new AtomicInteger();
Context context = vertx.getOrCreateContext();
context.runOnContext(v -> {
for (SQLConnection conn : conns) {
conn.setAutoCommit(false, onSuccess(ar1 -> {
conn.execute("LOCK TABLE insert_table WRITE", onSuccess(ar2 -> {
String sql = "INSERT INTO insert_table VALUES (null, 'doe', 'john', '2001-01-01');";
conn.update(sql, onSuccess(res3 -> {
conn.commit(onSuccess(committed -> {
conn.close(onSuccess(closed -> {
if (count.incrementAndGet() == numConns) {
testComplete();
}
}));
}));
}));
}));
}));
}
});
await();
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
conn.commit(onSuccess(v -> {
client.getConnection(onSuccess(newconn -> {
代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client
@Test
public void testCommitWhenNotInTransaction(TestContext context) {
int id = 0;
String name = "adele";
Async async = context.async();
client.getConnection(ar -> {
ensureSuccess(context, ar);
conn = ar.result();
setupSimpleTable(conn, ar2 -> {
ensureSuccess(context, ar2);
conn.setAutoCommit(false, ar3 -> {
ensureSuccess(context, ar3);
conn.updateWithParams("UPDATE test_table SET name=? WHERE id=?",
new JsonArray().add(name).add(id), ar4 -> {
ensureSuccess(context, ar4);
conn.setAutoCommit(true, ar5 -> {
ensureSuccess(context, ar5);
conn.commit(ar6 -> {
context.assertTrue(ar6.failed());
async.complete();
});
});
});
});
});
});
}
代码示例来源:origin: io.vertx/vertx-mysql-postgresql-client-jasync
@Test
public void testCommitWhenNotInTransaction(TestContext context) {
int id = 0;
String name = "adele";
Async async = context.async();
client.getConnection(ar -> {
ensureSuccess(context, ar);
conn = ar.result();
setupSimpleTable(conn, ar2 -> {
ensureSuccess(context, ar2);
conn.setAutoCommit(false, ar3 -> {
ensureSuccess(context, ar3);
conn.updateWithParams("UPDATE test_table SET name=? WHERE id=?",
new JsonArray().add(name).add(id), ar4 -> {
ensureSuccess(context, ar4);
conn.setAutoCommit(true, ar5 -> {
ensureSuccess(context, ar5);
conn.commit(ar6 -> {
context.assertTrue(ar6.failed());
async.complete();
});
});
});
});
});
});
}
代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client
@Test
public void testCommitWhenNotInTransaction(TestContext context) {
int id = 0;
String name = "adele";
Async async = context.async();
client.getConnection(ar -> {
ensureSuccess(context, ar);
conn = ar.result();
setupSimpleTable(conn, ar2 -> {
ensureSuccess(context, ar2);
conn.setAutoCommit(false, ar3 -> {
ensureSuccess(context, ar3);
conn.updateWithParams("UPDATE test_table SET name=? WHERE id=?",
new JsonArray().add(name).add(id), ar4 -> {
ensureSuccess(context, ar4);
conn.setAutoCommit(true, ar5 -> {
ensureSuccess(context, ar5);
conn.commit(ar6 -> {
context.assertTrue(ar6.failed());
async.complete();
});
});
});
});
});
});
}
内容来源于网络,如有侵权,请联系作者删除!