Package com.datastax.driver.core

Examples of com.datastax.driver.core.PreparedStatement


        log.trace("Get cache for operation {} on entity class {} and property {}", changeType.name(),
                entityClass, pm.getPropertyName());

        StatementCacheKey cacheKey = new StatementCacheKey(changeType.cacheType(), Sets.newHashSet(pm.getPropertyName()), entityClass, context.getOptions());

        PreparedStatement ps = dynamicPSCache.getIfPresent(cacheKey);
        if (ps == null) {
            ps = generator.prepareCollectionAndMapUpdate(session, context.getEntityMeta(), changeSet, context.getOptions());
            dynamicPSCache.put(cacheKey, ps);
            displayCacheStatistics(dynamicPSCache);
        }
View Full Code Here


    public PreparedStatement getCacheForSliceSelectAndIterator(Session session, Cache<StatementCacheKey,PreparedStatement> dynamicPSCache,
            SliceQueryProperties sliceQueryProperties) {

        StatementCacheKey cacheKey = new StatementCacheKey(CacheType.SLICE_QUERY_SELECT, sliceQueryProperties);
        PreparedStatement ps = dynamicPSCache.getIfPresent(cacheKey);
        if (ps == null) {
            ps = generator.prepareSelectSliceQuery(session, sliceQueryProperties);
            dynamicPSCache.put(cacheKey, ps);
            displayCacheStatistics(dynamicPSCache);
        }
View Full Code Here

    }

    public PreparedStatement getCacheForSliceDelete(Session session, Cache<StatementCacheKey,PreparedStatement> dynamicPSCache,
            SliceQueryProperties sliceQueryProperties) {
        StatementCacheKey cacheKey = new StatementCacheKey(CacheType.SLICE_QUERY_DELETE, sliceQueryProperties);
        PreparedStatement ps = dynamicPSCache.getIfPresent(cacheKey);
        if (ps == null) {
            ps = generator.prepareDeleteSliceQuery(session, sliceQueryProperties);
            dynamicPSCache.put(cacheKey, ps);
            displayCacheStatistics(dynamicPSCache);
        }
View Full Code Here

    }

    @Override
    public void logDMLStatement(String indentation) {
        if (dmlLogger.isDebugEnabled() || displayDMLForEntity) {
            PreparedStatement ps = boundStatement.preparedStatement();
            String queryType = "Bound statement";
            String queryString = ps.getQueryString();
            String consistencyLevel = boundStatement.getConsistencyLevel() == null ? "DEFAULT" : boundStatement
                    .getConsistencyLevel().name();
            writeDMLStatementLog(queryType, queryString, consistencyLevel, values);
        }
    }
View Full Code Here

                assignments = changeSet.generateUpdateForRemovedKey(conditions);
                break;
        }

        final RegularStatement regularStatement = prepareWhereClauseWithTTLForUpdate(meta.getIdMeta(), assignments,changeSet.getPropertyMeta().structure().isStaticColumn(), options);
        final PreparedStatement preparedStatement = session.prepare(regularStatement);
        return preparedStatement;
    }
View Full Code Here

    }

    public void pushInsertStatement(DaoOperations context, List<PropertyMeta> pms) {
        log.debug("Push insert statement for PersistenceContext '{}' and properties '{}'", context, pms);

        PreparedStatement ps = cacheManager.getCacheForEntityInsert(session, dynamicPSCache, context, pms);
        BoundStatementWrapper bsWrapper = binder.bindForInsert(context, ps, pms);
        context.pushStatement(bsWrapper);
    }
View Full Code Here

    }

    public void pushUpdateStatement(DaoOperations context, List<PropertyMeta> pms) {
        log.debug("Push update statement for PersistenceContext '{}' and properties '{}'", context, pms);

        PreparedStatement ps = cacheManager.getCacheForFieldsUpdate(session, dynamicPSCache, context, pms);
        BoundStatementWrapper bsWrapper = binder.bindForUpdate(context, ps, pms);
        context.pushStatement(bsWrapper);
    }
View Full Code Here

            ConsistencyLevel writeLevel = overrider.getWriteLevel(context);
            final Pair<Update.Where, Object[]> pair = statementGenerator.generateCollectionAndMapUpdateOperation(context, changeSet);
            context.pushStatement(new RegularStatementWrapper(context.getEntityClass(), pair.left, pair.right, getCQLLevel(writeLevel),
         context.getCASResultListener(), context.getSerialConsistencyLevel()));
        } else {
            PreparedStatement ps = cacheManager.getCacheForCollectionAndMapOperation(session, dynamicPSCache, context, propertyMeta, changeSet);
            BoundStatementWrapper bsWrapper = binder.bindForCollectionAndMapUpdate(context, ps, changeSet);
            context.pushStatement(bsWrapper);
        }
    }
View Full Code Here

        }
    }

    public Row loadProperty(DaoOperations context, PropertyMeta pm) {
        log.debug("Load property '{}' for PersistenceContext '{}'", pm, context);
        PreparedStatement ps = cacheManager.getCacheForFieldSelect(session, dynamicPSCache, context, pm);
        final ListenableFuture<ResultSet> resultSetFuture = executeReadWithConsistency(context, ps, pm.structure().isStaticColumn());
        final ListenableFuture<Row> futureRows = asyncUtils.transformFuture(resultSetFuture, RESULTSET_TO_ROW, executorService);
        return asyncUtils.buildInterruptible(futureRows).getImmediately();
    }
View Full Code Here

    }

    // Simple counter
    public void bindForSimpleCounterIncrement(DaoOperations context, PropertyMeta counterMeta, Long increment) {
        log.debug("Push simple counter increment statement for PersistenceContext '{}' and value '{}'", context, increment);
        PreparedStatement ps = counterQueryMap.get(INCR);
        ConsistencyLevel writeLevel = overrider.getWriteLevel(context, counterMeta);
        BoundStatementWrapper bsWrapper = binder.bindForSimpleCounterIncrementDecrement(context, ps, counterMeta, increment, writeLevel);
        context.pushCounterStatement(bsWrapper);
    }
View Full Code Here

TOP

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

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.