Examples of BoundStatementWrapper


Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

    public ListenableFuture<Row> getClusteredCounter(DaoOperations context) {
        log.debug("Get clustered counter for PersistenceContext '{}'", context);
        EntityMeta entityMeta = context.getEntityMeta();
        PreparedStatement ps = clusteredCounterQueryMap.get(entityMeta.getEntityClass()).get(SELECT).get(SELECT_ALL.name());
        ConsistencyLevel consistencyLevel = overrider.getReadLevel(context);
        BoundStatementWrapper bsWrapper = binder.bindForClusteredCounterSelect(context, ps, false, consistencyLevel);
        final ListenableFuture<ResultSet> resultSetFuture = context.executeImmediate(bsWrapper);
        return asyncUtils.transformFuture(resultSetFuture, RESULTSET_TO_ROW, executorService);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

        log.debug("Get clustered counter for PersistenceContext '{}'", context);

        final String cql3ColumnName = counterMeta.getCQL3ColumnName();
        PreparedStatement ps = clusteredCounterQueryMap.get(context.getEntityClass()).get(SELECT).get(cql3ColumnName);
        ConsistencyLevel readLevel = overrider.getReadLevel(context, counterMeta);
        BoundStatementWrapper bsWrapper = binder.bindForClusteredCounterSelect(context, ps, counterMeta.structure().isStaticColumn(), readLevel);

        final ListenableFuture<ResultSet> resultSetFuture = context.executeImmediate(bsWrapper);
        final ListenableFuture<Row> futureRow = asyncUtils.transformFuture(resultSetFuture, RESULTSET_TO_ROW, executorService);
        final Row row = asyncUtils.buildInterruptible(futureRow).getImmediately();
        return rowToLongFunction(cql3ColumnName).apply(row);
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

    }

    public void bindForClusteredCounterDelete(DaoOperations context) {
        log.debug("Push clustered counter deletion statement for PersistenceContext '{}'", context);
        PreparedStatement ps = clusteredCounterQueryMap.get(context.getEntityClass()).get(DELETE).get(DELETE_ALL.name());
        BoundStatementWrapper bsWrapper = binder.bindForClusteredCounterDelete(context, ps);
        context.pushCounterStatement(bsWrapper);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

        final BoundStatement bs = ps.bind(boundValues);
        sliceQueryProperties.setFetchSizeToStatement(bs);

        final ConsistencyLevel readLevel =  sliceQueryProperties.getConsistencyLevelOr(defaultReadConsistencyLevel);

        return new BoundStatementWrapper(sliceQueryProperties.getEntityClass(),bs,boundValues, getCQLLevel(readLevel),
                Optional.<CASResultListener>absent(), Optional.<com.datastax.driver.core.ConsistencyLevel>absent());
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

                Optional.<CASResultListener>absent(), Optional.<com.datastax.driver.core.ConsistencyLevel>absent());
    }

    private ListenableFuture<ResultSet> executeReadWithConsistency(DaoOperations context, PreparedStatement ps, boolean onlyStaticColumns) {
        ConsistencyLevel readLevel = overrider.getReadLevel(context);
        BoundStatementWrapper bsWrapper = binder.bindStatementWithOnlyPKInWhereClause(context, ps, onlyStaticColumns, readLevel);
        return context.executeImmediate(bsWrapper);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

    }

    protected <T> ListenableFuture<List<T>> coreAsyncGet(SliceQueryProperties<T> sliceQueryProperties) {
        final EntityMeta meta = sliceQueryProperties.getEntityMeta();

        final BoundStatementWrapper bsWrapper = daoContext.bindForSliceQuerySelect(sliceQueryProperties, defaultReadLevel);

        final ListenableFuture<ResultSet> resultSetFuture = daoContext.execute(bsWrapper);
        final ListenableFuture<List<Row>> futureRows = asyncUtils.transformFuture(resultSetFuture, RESULTSET_TO_ROWS, executorService);
        Function<List<Row>, List<T>> rowsToEntities = new Function<List<Row>, List<T>>() {
            @Override
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

        return asyncIterator(sliceQueryProperties).getImmediately();
    }

    public <T> AchillesFuture<Iterator<T>> asyncIterator(final SliceQueryProperties<T> sliceQueryProperties) {
        log.debug("Get iterator for slice query asynchronously");
        final BoundStatementWrapper bsWrapper = daoContext.bindForSliceQuerySelect(sliceQueryProperties, defaultReadLevel);
        final ListenableFuture<ResultSet> resultSetFuture = daoContext.execute(bsWrapper);
        final ListenableFuture<Iterator<Row>> futureIterator = asyncUtils.transformFuture(resultSetFuture, RESULTSET_TO_ITERATOR, executorService);

        Function<Iterator<Row>, Iterator<T>> rowToIterator = new Function<Iterator<Row>, Iterator<T>>() {
            @Override
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

        asyncDelete(sliceQueryProperties).getImmediately();
    }

    public <T> AchillesFuture<Empty> asyncDelete(final SliceQueryProperties<T> sliceQueryProperties) {
        log.debug("Slice delete");
        final BoundStatementWrapper bsWrapper = daoContext.bindForSliceQueryDelete(sliceQueryProperties, defaultWriteLevel);
        final ListenableFuture<ResultSet> resultSetFuture = daoContext.execute(bsWrapper);
        final ListenableFuture<Empty> listenableFuture = asyncUtils.transformFutureToEmpty(resultSetFuture, executorService);
        asyncUtils.maybeAddAsyncListeners(listenableFuture, sliceQueryProperties.getAsyncListeners(), executorService);
        return asyncUtils.buildInterruptible(listenableFuture);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

        when(sliceQueryProperties.getBoundValues()).thenReturn(boundValues);
        when(sliceQueryProperties.getConsistencyLevelOr(EACH_QUORUM)).thenReturn(LOCAL_QUORUM);
        when(ps.bind(boundValues)).thenReturn(bs);

        //When
        final BoundStatementWrapper bsWrapper = daoContext.bindForSliceQuerySelect(sliceQueryProperties, EACH_QUORUM);

        //Then
        assertThat(bsWrapper.getStatement()).isSameAs(bs);
        assertThat(bsWrapper.getValues()).isSameAs(boundValues);

        verify(bs).setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel.LOCAL_QUORUM);
        verify(sliceQueryProperties).setFetchSizeToStatement(bs);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.statement.wrapper.BoundStatementWrapper

        when(sliceQueryProperties.getBoundValues()).thenReturn(boundValues);
        when(sliceQueryProperties.getConsistencyLevelOr(EACH_QUORUM)).thenReturn(LOCAL_QUORUM);
        when(ps.bind(boundValues)).thenReturn(bs);

        //When
        final BoundStatementWrapper bsWrapper = daoContext.bindForSliceQueryDelete(sliceQueryProperties, EACH_QUORUM);

        //Then
        assertThat(bsWrapper.getStatement()).isSameAs(bs);
        assertThat(bsWrapper.getValues()).isSameAs(boundValues);

        verify(bs).setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel.LOCAL_QUORUM);
        verify(sliceQueryProperties).setFetchSizeToStatement(bs);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.