当前位置: 首页>>代码示例>>Java>>正文


Java BoundStatement.setInt方法代码示例

本文整理汇总了Java中com.datastax.driver.core.BoundStatement.setInt方法的典型用法代码示例。如果您正苦于以下问题:Java BoundStatement.setInt方法的具体用法?Java BoundStatement.setInt怎么用?Java BoundStatement.setInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.BoundStatement的用法示例。


在下文中一共展示了BoundStatement.setInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import com.datastax.driver.core.BoundStatement; //导入方法依赖的package包/类
@Override
public ListenableFuture<Void> save(EntityId entityId, TsKvEntry tsKvEntry, long ttl) {
    long partition = toPartitionTs(tsKvEntry.getTs());
    DataType type = tsKvEntry.getDataType();
    BoundStatement stmt = (ttl == 0 ? getSaveStmt(type) : getSaveTtlStmt(type)).bind();
    stmt.setString(0, entityId.getEntityType().name())
            .setUUID(1, entityId.getId())
            .setString(2, tsKvEntry.getKey())
            .setLong(3, partition)
            .setLong(4, tsKvEntry.getTs());
    addValue(tsKvEntry, stmt, 5);
    if (ttl > 0) {
        stmt.setInt(6, (int) ttl);
    }
    return getFuture(executeAsyncWrite(stmt), rs -> null);
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:17,代码来源:CassandraBaseTimeseriesDao.java

示例2: findAllAsyncSequentiallyWithLimit

import com.datastax.driver.core.BoundStatement; //导入方法依赖的package包/类
private void findAllAsyncSequentiallyWithLimit(final TsKvQueryCursor cursor, final SimpleListenableFuture<List<TsKvEntry>> resultFuture) {
    if (cursor.isFull() || !cursor.hasNextPartition()) {
        resultFuture.set(cursor.getData());
    } else {
        PreparedStatement proto = getFetchStmt(Aggregation.NONE);
        BoundStatement stmt = proto.bind();
        stmt.setString(0, cursor.getEntityType());
        stmt.setUUID(1, cursor.getEntityId());
        stmt.setString(2, cursor.getKey());
        stmt.setLong(3, cursor.getNextPartition());
        stmt.setLong(4, cursor.getStartTs());
        stmt.setLong(5, cursor.getEndTs());
        stmt.setInt(6, cursor.getCurrentLimit());

        Futures.addCallback(executeAsyncRead(stmt), new FutureCallback<ResultSet>() {
            @Override
            public void onSuccess(@Nullable ResultSet result) {
                cursor.addData(convertResultToTsKvEntryList(result.all()));
                findAllAsyncSequentiallyWithLimit(cursor, resultFuture);
            }

            @Override
            public void onFailure(Throwable t) {
                log.error("[{}][{}] Failed to fetch data for query {}-{}", stmt, t);
            }
        }, readResultsProcessingExecutor);
    }
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:29,代码来源:CassandraBaseTimeseriesDao.java

示例3: savePartition

import com.datastax.driver.core.BoundStatement; //导入方法依赖的package包/类
@Override
public ListenableFuture<Void> savePartition(EntityId entityId, long tsKvEntryTs, String key, long ttl) {
    long partition = toPartitionTs(tsKvEntryTs);
    log.debug("Saving partition {} for the entity [{}-{}] and key {}", partition, entityId.getEntityType(), entityId.getId(), key);
    BoundStatement stmt = (ttl == 0 ? getPartitionInsertStmt() : getPartitionInsertTtlStmt()).bind();
    stmt = stmt.setString(0, entityId.getEntityType().name())
            .setUUID(1, entityId.getId())
            .setLong(2, partition)
            .setString(3, key);
    if (ttl > 0) {
        stmt.setInt(4, (int) ttl);
    }
    return getFuture(executeAsyncWrite(stmt), rs -> null);
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:15,代码来源:CassandraBaseTimeseriesDao.java


注:本文中的com.datastax.driver.core.BoundStatement.setInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。