本文整理了Java中com.datastax.driver.core.querybuilder.Insert.setSerialConsistencyLevel()
方法的一些代码示例,展示了Insert.setSerialConsistencyLevel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Insert.setSerialConsistencyLevel()
方法的具体详情如下:
包路径:com.datastax.driver.core.querybuilder.Insert
类名称:Insert
方法名:setSerialConsistencyLevel
暂无
代码示例来源:origin: otaviojava/Easy-Cassandra
@Override
public InsertBuilder<T> withSerialConsistencyLevel(ConsistencyLevel serialConsistency) {
insert.setSerialConsistencyLevel(serialConsistency);
return this;
}
代码示例来源:origin: net.oneandone/troilus-core-java7
private static Statement toInsertStatement(WriteQueryData data,Context ctx) {
Insert insert = insertInto(ctx.getDbSession().getTablename());
List<Object> values = Lists.newArrayList();
for(Entry<String, Optional<Object>> entry : data.getValuesToMutate().entrySet()) {
insert.value(entry.getKey(), bindMarker());
values.add(ctx.toStatementValue(entry.getKey(), entry.getValue().orNull()));
}
if (data.getIfNotExits() != null) {
insert.ifNotExists();
if (ctx.getSerialConsistencyLevel() != null) {
insert.setSerialConsistencyLevel(ctx.getSerialConsistencyLevel());
}
}
if (ctx.getTtlSec() != null) {
insert.using(ttl(bindMarker()));
values.add((Integer) ctx.getTtlSec());
}
PreparedStatement stmt = ctx.getDbSession().prepare(insert);
return stmt.bind(values.toArray());
}
代码示例来源:origin: net.oneandone.troilus/troilus-core-java7
private static ListenableFuture<Statement> toInsertStatementAsync(WriteQueryData data, ExecutionSpec executionSpec, UDTValueMapper udtValueMapper, DBSession dbSession) {
final Insert insert = (data.getTablename().getKeyspacename() == null) ? insertInto(data.getTablename().getTablename())
: insertInto(data.getTablename().getKeyspacename(), data.getTablename().getTablename());
final List<Object> values = Lists.newArrayList();
for(Entry<String, Optional<Object>> entry : data.getValuesToMutate().entrySet()) {
insert.value(entry.getKey(), bindMarker());
values.add(udtValueMapper.toStatementValue(data.getTablename(), entry.getKey(), entry.getValue().orNull()));
}
if (data.getIfNotExits() != null) {
insert.ifNotExists();
if (executionSpec.getSerialConsistencyLevel() != null) {
insert.setSerialConsistencyLevel(executionSpec.getSerialConsistencyLevel());
}
}
if (executionSpec.getTtl() != null) {
insert.using(ttl(bindMarker()));
values.add((Integer) executionSpec.getTtl());
}
final ListenableFuture<PreparedStatement> preparedStatementFuture = dbSession.prepareAsync(insert);
return dbSession.bindAsync(preparedStatementFuture, values.toArray());
}
内容来源于网络,如有侵权,请联系作者删除!