Package com.datastax.driver.core

Examples of com.datastax.driver.core.BoundStatement


                break;
        }

        values.addAll(fetchPrimaryKeyValues(entityMeta, entity, changeSet.getPropertyMeta().structure().isStaticColumn()));
        values.addAll(fetchCASConditionsValues(context, entityMeta));
        BoundStatement bs = ps.bind(values.toArray());

        return new BoundStatementWrapper(context.getEntityClass(), bs, values.toArray(), getCQLLevel(consistencyLevel),
                context.getCASResultListener(), context.getSerialConsistencyLevel());
    }
View Full Code Here


        log.trace("Bind prepared statement {} with primary key {}", ps.getQueryString(), primaryKey);

        PropertyMeta idMeta = context.getIdMeta();
        List<Object> values = bindPrimaryKey(primaryKey, idMeta,onlyStaticColumns);

        BoundStatement bs = ps.bind(values.toArray());
        return new BoundStatementWrapper(context.getEntityClass(), bs, values.toArray(), getCQLLevel(consistencyLevel),
                context.getCASResultListener(), context.getSerialConsistencyLevel());
    }
View Full Code Here

            log.trace("Bind prepared statement {} for simple counter increment of {} using primary key {} and value {}", ps.getQueryString(), pm, primaryKey, increment);
        }

        Object[] boundValues = ArrayUtils.add(extractValuesForSimpleCounterBinding(entityMeta, pm, primaryKey), 0, increment);

        BoundStatement bs = ps.bind(boundValues);
        return new BoundStatementWrapper(context.getEntityClass(), bs, boundValues, getCQLLevel(consistencyLevel), NO_LISTENER, NO_SERIAL_CONSISTENCY);
    }
View Full Code Here

        if (log.isTraceEnabled()) {
            log.trace("Bind prepared statement {} for simple counter read of {} using primary key {}", ps.getQueryString(), pm, primaryKey);
        }

        Object[] boundValues = extractValuesForSimpleCounterBinding(entityMeta, pm, primaryKey);
        BoundStatement bs = ps.bind(boundValues);
        return new BoundStatementWrapper(context.getEntityClass(), bs, boundValues, getCQLLevel(consistencyLevel), NO_LISTENER, NO_SERIAL_CONSISTENCY);
    }
View Full Code Here

        }

        ConsistencyLevel consistencyLevel = overrider.getWriteLevel(context);

        Object[] boundValues = extractValuesForSimpleCounterBinding(entityMeta, pm, primaryKey);
        BoundStatement bs = ps.bind(boundValues);
        return new BoundStatementWrapper(context.getEntityClass(), bs, boundValues, getCQLLevel(consistencyLevel), NO_LISTENER, NO_SERIAL_CONSISTENCY);
    }
View Full Code Here

        ConsistencyLevel consistencyLevel = overrider.getWriteLevel(context);

        List<Object> primaryKeys = bindPrimaryKey(primaryKey, entityMeta.getIdMeta(), counterMeta.structure().isStaticColumn());
        Object[] keys = addAll(new Object[]{increment}, primaryKeys.toArray());

        BoundStatement bs = ps.bind(keys);

        return new BoundStatementWrapper(context.getEntityClass(), bs, keys, getCQLLevel(consistencyLevel), NO_LISTENER, NO_SERIAL_CONSISTENCY);
    }
View Full Code Here

        }

        List<Object> primaryKeys = bindPrimaryKey(primaryKey, entityMeta.getIdMeta(), onlyStaticColumns);
        Object[] boundValues = primaryKeys.toArray();

        BoundStatement bs = ps.bind(boundValues);
        return new BoundStatementWrapper(context.getEntityClass(), bs, boundValues, getCQLLevel(consistencyLevel), NO_LISTENER, NO_SERIAL_CONSISTENCY);
    }
View Full Code Here

        }

        ConsistencyLevel consistencyLevel = overrider.getWriteLevel(context);
        List<Object> primaryKeys = bindPrimaryKey(primaryKey, entityMeta.getIdMeta(), false);
        Object[] boundValues = primaryKeys.toArray(new Object[primaryKeys.size()]);
        BoundStatement bs = ps.bind(boundValues);

        return new BoundStatementWrapper(context.getEntityClass(), bs, boundValues, getCQLLevel(consistencyLevel), NO_LISTENER, NO_SERIAL_CONSISTENCY);
    }
View Full Code Here

        return buildBSForSliceQuery(sliceQueryProperties, defaultWriteConsistencyLevel, ps);
    }

    private BoundStatementWrapper buildBSForSliceQuery(SliceQueryProperties<?> sliceQueryProperties, ConsistencyLevel defaultReadConsistencyLevel, PreparedStatement ps) {
        final Object[] boundValues = sliceQueryProperties.getBoundValues();
        final BoundStatement bs = ps.bind(boundValues);
        sliceQueryProperties.setFetchSizeToStatement(bs);

        final ConsistencyLevel readLevel =  sliceQueryProperties.getConsistencyLevelOr(defaultReadConsistencyLevel);

        return new BoundStatementWrapper(sliceQueryProperties.getEntityClass(),bs,boundValues, getCQLLevel(readLevel),
View Full Code Here

    public void should_get_bound_statement() throws Exception {
        //Given
        wrapper = new BoundStatementWrapper(CompleteBean.class, bs, new Object[] { 1 }, ConsistencyLevel.ONE, NO_LISTENER, fromNullable(ConsistencyLevel.LOCAL_SERIAL));

        //When
        final BoundStatement expectedBs = wrapper.getStatement();

        //Then
        assertThat(expectedBs).isSameAs(bs);
        verify(bs).setSerialConsistencyLevel(ConsistencyLevel.LOCAL_SERIAL);
    }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.BoundStatement

Copyright © 2018 www.massapicom. 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.