Package com.datastax.driver.core

Examples of com.datastax.driver.core.BoundStatement


            if (!markAsUnused) {
                // store content as used
                String stmt = "INSERT INTO modeshape.binary (cid, payload, usage) VALUES (?,?,1)";
                PreparedStatement preparedStatement = session.prepare(stmt);
                BoundStatement statement = new BoundStatement(preparedStatement);
                session.execute(statement.bind(key.toString(), buffer(stream)));
            } else {
                // store content as un-used
                String stmt = "INSERT INTO modeshape.binary (cid, usage_time, payload, usage) VALUES (?,?,?,0)";
                PreparedStatement preparedStatement = session.prepare(stmt);
                BoundStatement statement = new BoundStatement(preparedStatement);
                session.execute(statement.bind(key.toString(), new Date(), buffer(stream)));
            }
            return new StoredBinaryValue(this, key, temp.getSize());
        } catch (BinaryStoreException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here


    @Override
    public void markAsUnused( Iterable<BinaryKey> keys ) throws BinaryStoreException {
        PreparedStatement preparedStatement = session.prepare("UPDATE modeshape.binary SET usage = ?, usage_time = ? WHERE cid = ?");
        try {
            for (BinaryKey key : keys) {
                BoundStatement statement = new BoundStatement(preparedStatement);
                session.execute(statement.bind(0, new Date(), key.toString()));
            }
        } catch (RuntimeException e) {
            throw new BinaryStoreException(e);
        }
    }
View Full Code Here

    @Override
    public void storeFile(FileInfo fileInfo, final FutureCallback<Void> callback) {

        final Metrics.Context context = fileMetrics.timeWrite();

        BoundStatement insert = statements
                .getStoreFile()
                .bind(
                        fileInfo.getId(),
                        fileInfo.getLength(),
                        fileInfo.getChunkSize(),
View Full Code Here

    @Override
    public void storeChunk(ChunkInfo chunkInfo, final FutureCallback<Void> callback) {

        final Metrics.Context context = chunkMetrics.timeWrite();

        BoundStatement insert = statements
                .getStoreChunk()
                .bind(
                        chunkInfo.getId(),
                        chunkInfo.getNum(),
                        ByteBuffer.wrap(chunkInfo.getData())
View Full Code Here

    @Override
    public void loadFile(final UUID id, final FutureCallback<FileInfo> callback) {

        final Metrics.Context context = fileMetrics.timeRead();

        BoundStatement select = statements.getLoadFile().bind(id);
        session.executeAsync(select, new FutureCallback<ResultSet>() {
            @Override
            public void onSuccess(ResultSet result) {
                Row row = result.one();
                if (row == null) {
View Full Code Here

    @Override
    public void loadChunk(final UUID id, final int n, final FutureCallback<ChunkInfo> callback) {

        final Metrics.Context context = chunkMetrics.timeRead();

        BoundStatement select = statements.getLoadChunk().bind(id, n);
        session.executeAsync(select, new FutureCallback<ResultSet>() {
            @Override
            public void onSuccess(ResultSet result) {
                Row row = result.one();
                if (row == null) {
View Full Code Here

  @Override
  public Set<EventBean> lookup(Object[] keys, EventBean[] eventsPerStream) {
    synchronized (_statement) {

      final BoundStatement boundStatement = _statement.bind(keys);

      final ResultSet cassandraResultList = _session
          .execute(boundStatement);

      final Set<EventBean> esperResultSet = new HashSet<EventBean>();
View Full Code Here

            batch.add(deleteStatement);
            bindArguments.add(pathToDelete);
        }

        if (batchContext == null) {
            BoundStatement query = session.prepare(batch.getQueryString()).bind(bindArguments.toArray());
            query.setConsistencyLevel(defaultConsistencyLevel);
            session.execute(query);
        }
    }
View Full Code Here

        List<Object> values = new ArrayList<>();
        values.addAll(fetchPrimaryKeyValues(entityMeta, entity, false));
        values.addAll(fetchPropertiesValues(pms, entity));
        values.addAll(fetchTTLAndTimestampValues(context));

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

        values.addAll(fetchTTLAndTimestampValues(context));
        values.addAll(fetchPropertiesValues(pms, entity));
        values.addAll(fetchPrimaryKeyValues(entityMeta, entity, onlyStaticColumns));
        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

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.