Package com.datastax.driver.core

Examples of com.datastax.driver.core.BoundStatement$DataWrapper


                                        StatementOptions statementOptions) {
        this.root.setupQueryBinder(queryBinder, persistOptions, queryName, statementOptions);
    }

    @Override <T> void executeQuery(ExecutionTracer tracer, QueryBinderImpl<T> queryBinder, ReadFutureImpl<T> futures) {
        BoundStatement bStmt = queryBinder.statementFor(root.type);
        if (bStmt != null) {
            futures.addResultSetFuture(this, queryBinder.session.executeAsync(bStmt), queryBinder.readColumnsFor(root.type));
        }
    }
View Full Code Here


            if (!changed) {
                return null;
            }

            Session session = driverSession();
            BoundStatement bStmt = entity.updateBoundStatement(statementOptions, session, instance, binder);
            ExecutionTracer tracer = executionTracer(PersistenceSessionTrackingImpl.this, entity);
            return new ModifyFutureImpl<T>(PersistenceSessionTrackingImpl.this, tracer, null, session.executeAsync(bStmt), entity, instance,
                PersistMode.UPDATE);
        }
View Full Code Here

                binder.setBytesUnsafe(valueColumn, valuePrimitive.serialize(entry.getValue(), protocolVersion));
            } else {
                buildModifyBindColumns(entry.getValue(), binder, valueAttributes);
            }

            BoundStatement bStmt = buildModifyInitial(session, persistOptions, PreparedStatements.StatementType.INSERT, binder);
            int idx = binder.bindColumns(0, bStmt);
            bindUsingOptions(bStmt, persistOptions, idx);
            statementOptions.applyWrite(bStmt, writeConsistencyLevel, serialConsistencyLevel, persistOptions);

            if (prePersist != null) {
View Full Code Here

                } else {
                    buildModifyBindColumns(key, binder, clusteringKeyAttributes);
                }
            }

            BoundStatement bStmt = buildModifyInitial(session, persistOptions, PreparedStatements.StatementType.DELETE, binder);
            int idx = binder.bindColumns(0, bStmt);
            bindUsingOptions(bStmt, persistOptions, idx);
            statementOptions.applyWrite(bStmt, writeConsistencyLevel, serialConsistencyLevel, persistOptions);

            if (prePersist != null) {
                prePersist.invoke(instance, this, type, bStmt);
            }

            batch.add(bStmt);
        }

        // UPDATE keyspace_name.table_name
        // USING option AND option
        // SET assignment , assignment, ...
        // WHERE row_specification
        // IF column_name = literal AND column_name = literal . . .

        int protocolVersion = persistenceSession.persistenceManager.protocolVersion;

        CqlColumn[] columns = PersistOption.ColumnRestrictionOption.filter(persistOptions, writeDataColumns);
        Binder binder = new Binder(columns, true, primaryKeyColumns, PersistMode.UPDATE, true);
        for (Map.Entry entry : instance.getCluster().entrySet()) {
            binder.reset();

            buildModifyBindColumns(instance, binder, partitionAttributes);
            if (clusteringColumn != null) {
                binder.setBytesUnsafe(clusteringColumn, clusteringPrimitive.serialize(entry.getKey(), protocolVersion));
            } else {
                buildModifyBindColumns(entry.getKey(), binder, clusteringKeyAttributes);
            }
            if (valueColumn != null) {
                binder.setBytesUnsafe(valueColumn, valuePrimitive.serialize(entry.getValue(), protocolVersion));
            } else {
                buildModifyBindColumns(entry.getValue(), binder, valueAttributes);
            }

            BoundStatement bStmt = buildModifyInitial(session, persistOptions, PreparedStatements.StatementType.UPDATE, binder);
            int idx = bindUsingOptions(bStmt, persistOptions, 0);
            idx = binder.bindColumns(idx, bStmt);
            bindIfOptions(binder, bStmt, persistOptions, idx);
            statementOptions.applyWrite(bStmt, writeConsistencyLevel, serialConsistencyLevel, persistOptions);
View Full Code Here

        Session session = persistenceSession.driverSession();

        Binder binder = new Binder(null, true, partitionKeyColumns, PersistMode.DELETE, true);
        buildModifyBindColumns(instance, binder, partitionAttributes);
        BoundStatement bStmt = buildModifyInitial(session, persistOptions, PreparedStatements.StatementType.DELETE, binder);

        int idx = bindUsingOptions(bStmt, persistOptions, 0);

        binder.bindColumns(idx, bStmt);
View Full Code Here

    }

    BoundStatement buildModifyInitial(Session session, PersistOption[] persistOptions, PreparedStatements.StatementType statementType,
                                      Binder binder) {
        PreparedStatement pStmt = preparedStatements.statementFor(session, statementType, binder, persistOptions);
        BoundStatement bStmt = pStmt.bind();

        binder.bindColumns(0, bStmt);

        PersistOption.forBoundStatement(persistOptions, bStmt);
        return bStmt;
View Full Code Here

        } catch (Throwable t) {
            throw new RuntimeException("Invalid primary key element "+Arrays.toString(primaryKey), t);
        }

        PreparedStatement pstmt = preparedStatements.statementFor(session, PreparedStatements.StatementType.SELECT, binder, persistOptions);
        BoundStatement bStmt = pstmt.bind();
        statementOptions.applyRead(bStmt, readConsistencyLevel, persistOptions);
        PersistOption.forBoundStatement(persistOptions, bStmt);

        idx = binder.bindColumns(0, bStmt);

        PersistOption.LimitOption.apply(bStmt, persistOptions, idx);

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Submitting load for {} : {}", type, bStmt.preparedStatement().getQueryString());
        }
        if (tracer != null) {
            tracer.onBeginQuery(futures.session, this, bStmt);
        }
        futures.addResultSetFuture(this, session.executeAsync(bStmt), readColumns);
View Full Code Here

        Session session = persistenceSession.driverSession();

        PreparedStatement pstmt = preparedStatements
            .statementFor(session, PreparedStatements.StatementType.SELECT, binder, persistOptions);
        BoundStatement bStmt = pstmt.bind();
        statementOptions.applyRead(bStmt, readConsistencyLevel, persistOptions);
        PersistOption.forBoundStatement(persistOptions, bStmt);

        int idx = binder.bindColumns(0, bStmt);
View Full Code Here

        CqlColumn[] readColumns = readColumns(persistOptions);

        PreparedStatement pstmt = preparedStatements.statementFor(queryBinder.session, PreparedStatements.StatementType.SELECT,
            readColumns, queryBinder.conditionFor((Class<? extends T>) type), persistOptions);
        BoundStatement bStmt = pstmt.bind();
        statementOptions.applyRead(bStmt, readConsistencyLevel, persistOptions);
        PersistOption.forBoundStatement(persistOptions, bStmt);
        queryBinder.addStatement((Class<? extends T>) type, bStmt, readColumns);
    }
View Full Code Here

        PersistOption.forBoundStatement(persistOptions, bStmt);
        queryBinder.addStatement((Class<? extends T>) type, bStmt, readColumns);
    }

    @Override <T> void executeQuery(ExecutionTracer tracer, QueryBinderImpl<T> queryBinder, ReadFutureImpl<T> futures) {
        BoundStatement bStmt = queryBinder.statementFor(type);
        if (bStmt != null) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Submitting query for {} : {}", type, bStmt.preparedStatement().getQueryString());
            }
            if (tracer != null) {
                tracer.onBeginQuery(futures.session, this, bStmt);
            }
            futures.addResultSetFuture(this, queryBinder.session.executeAsync(bStmt), queryBinder.readColumnsFor(type));
View Full Code Here

TOP

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

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.