Package org.caffinitas.mapper.core.codec

Examples of org.caffinitas.mapper.core.codec.Binder


        // USING option AND option
        // SET assignment , assignment, ...
        // WHERE row_specification
        // IF column_name = literal AND column_name = literal . . .
        CqlColumn[] columns = PersistOption.ColumnRestrictionOption.filter(persistOptions, writeDataColumns);
        Binder binder = new Binder(columns, true, primaryKeyColumns, PersistMode.UPDATE, true);

        buildModifyBindColumns(instance, binder);

        if (persistenceSession.filterUnmodifiedForUpdate(this, instance, binder)) {
            // return null to indicate that the update will not be executed
View Full Code Here


        // FROM keyspace_name. table_name
        // USING TIMESTAMP integer
        // WHERE row_specification
        // ( IF ( EXISTS | (column_name = literal ) ) AND ( column_name = literal ) . . . )

        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);

        bindIfOptions(binder, bStmt, persistOptions, idx);

        statementOptions.applyWrite(bStmt, writeConsistencyLevel, serialConsistencyLevel, persistOptions);
View Full Code Here

        }

        CqlColumn[] readColumns = readColumns(persistOptions);
        CqlColumn[] pkColumns = primaryKeyColumnsVariable[primaryKey.length - partitionKeyColumns.length];

        Binder binder = new Binder(readColumns, false, pkColumns, null, true);

        int idx = 0;
        try {
            for (CqlColumn col : pkColumns) {
                col.dataTypeMapper.fromObject(binder, col, primaryKey[idx++]);
            }
        } 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());
View Full Code Here

                System.arraycopy(aCols, 0, loadColumns, iCol, aColCnt);
                iCol += aColCnt;
            }
        }

        Binder binder = new Binder(loadColumns, false, primaryKeyColumns, null, true);

        buildModifyBindColumns(container, binder);

        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);

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

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Lazy load of {} attributes for {}", attrs.length, type);
View Full Code Here

    Object serializeAny(Object o) {
        if (o == null) {
            return null;
        }

        Binder compBinder = new Binder(allColumns, true, null, PersistMode.INSERT, true);

        for (MappedAttribute attribute : allAttributes) {
            attribute.bindToStatement(o, compBinder);
        }

        ByteBuffer compValue = compBinder.bindTuple();

        return compValue;
    }
View Full Code Here

TOP

Related Classes of org.caffinitas.mapper.core.codec.Binder

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.