當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。