Package com.datastax.driver.core

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


        CqlColumn[] columns = PersistOption.ColumnRestrictionOption.filter(persistOptions, writeDataColumns);
        Binder binder = new Binder(columns, true, primaryKeyColumns, PersistMode.INSERT, serializeDefault);

        buildModifyBindColumns(instance, binder);

        BoundStatement bStmt =
            buildModifyInitial(persistenceSession.driverSession(), persistOptions, PreparedStatements.StatementType.INSERT, binder);

        int idx = binder.bindColumns(0, bStmt);

        bindUsingOptions(bStmt, persistOptions, idx);
View Full Code Here


        if (persistenceSession.filterUnmodifiedForUpdate(this, instance, binder)) {
            // return null to indicate that the update will not be executed
            return null;
        }

        BoundStatement bStmt = updateBoundStatement(statementOptions, persistenceSession.driverSession(), instance, binder, persistOptions);

        return new BinderAndStatement(bStmt, binder);
    }
View Full Code Here

    // used by buildUpdateStatement and PersistenceSesss
    @Override BoundStatement updateBoundStatement(StatementOptions statementOptions, Session session, Object instance, Binder binder,
                                                  PersistOption... persistOptions) {
        persistOptions = withTTL(persistOptions);

        BoundStatement bStmt = buildModifyInitial(session, persistOptions, PreparedStatements.StatementType.UPDATE, binder);

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

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

        Binder binder = new Binder(null, false, primaryKeyColumns, PersistMode.DELETE, true);

        buildModifyBindColumns(instance, binder);

        BoundStatement bStmt =
            buildModifyInitial(persistenceSession.driverSession(), persistOptions, PreparedStatements.StatementType.DELETE, binder);

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

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

        if (isAbstract) {
            throw new ModelUseException("type " + type.getName() + " is abstract");
        }

        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

    @Override <T> void executeQuery(ExecutionTracer tracer, QueryBinderImpl<T> queryBinder, ReadFutureImpl<T> futures) {
        if (isAbstract) {
            return;
        }

        BoundStatement bStmt = queryBinder.statementFor(type);
        if (bStmt != null) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Submitting query for {} : {}", type, bStmt.preparedStatement().getQueryString());
            }
            futures.addResultSetFuture(this, queryBinder.session.executeAsync(bStmt), queryBinder.readColumnsFor(type));
        }
    }
View Full Code Here

        for (Column c : s) {
            try {
                String colValue = StandardConverters.convertFromBytes(String.class, c.getValue());
                PreparedStatement statement = session.prepare("INSERT INTO " + keys + "." + table + "(id, colname, colvalue) VALUES (?, ?, ?)");
                BoundStatement boundStatement = new BoundStatement(statement);
                if (colValue != null) {
                    session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowkey),
                            StandardConverters.convertFromBytes(String.class, c.getName()),
                            ByteBuffer.wrap(c.getValue())));
                } else {
                    session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowkey),
                            StandardConverters.convertFromBytes(String.class, c.getName()), ByteBuffer.wrap(nullArray)));
                }

            } catch (Exception e) {
                System.out.println(c.getValue() + "Exception:" + e.getMessage());
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.