Package com.datastax.driver.core

Examples of com.datastax.driver.core.PreparedStatement


        final PreparedStatement ps = cacheManager.getCacheForSliceSelectAndIterator(session, dynamicPSCache, sliceQueryProperties);
        return buildBSForSliceQuery(sliceQueryProperties, defaultReadConsistencyLevel, ps);
    }

    public BoundStatementWrapper bindForSliceQueryDelete(SliceQueryProperties<?> sliceQueryProperties, ConsistencyLevel defaultWriteConsistencyLevel) {
        final PreparedStatement ps = cacheManager.getCacheForSliceDelete(session, dynamicPSCache, sliceQueryProperties);
        return buildBSForSliceQuery(sliceQueryProperties, defaultWriteConsistencyLevel, ps);
    }
View Full Code Here


        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(ps);

        PreparedStatement actual = manager.getCacheForFieldSelect(session, cache, context, pm);

        assertThat(actual).isSameAs(ps);
        StatementCacheKey cacheKey = cacheKeyCaptor.getValue();
        assertThat(cacheKey.<CompleteBean>getEntityClass()).isSameAs(CompleteBean.class);
        assertThat(cacheKey.getType()).isEqualTo(CacheType.SELECT_FIELD);
View Full Code Here

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(pm.forCache().extractClusteredFieldsIfNecessary()).thenReturn(Sets.newLinkedHashSet("id", "a", "b"));
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(ps);

        PreparedStatement actual = manager.getCacheForFieldSelect(session, cache, context, pm);

        assertThat(actual).isSameAs(ps);
        StatementCacheKey cacheKey = cacheKeyCaptor.getValue();
        assertThat(cacheKey.getFields()).containsOnly("id", "a", "b");
    }
View Full Code Here

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(null);
        when(generator.prepareSelectField(session, meta, pm)).thenReturn(ps);

        PreparedStatement actual = manager.getCacheForFieldSelect(session, cache, context, pm);

        assertThat(actual).isSameAs(ps);
        StatementCacheKey cacheKey = cacheKeyCaptor.getValue();
        verify(cache).put(cacheKey, ps);
    }
View Full Code Here

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(ps);

        PreparedStatement actual = manager.getCacheForEntityInsert(session, cache, context, asList(nameMeta, ageMeta));

        assertThat(actual).isSameAs(ps);
        StatementCacheKey cacheKey = cacheKeyCaptor.getValue();
        assertThat(cacheKey.<CompleteBean>getEntityClass()).isSameAs(CompleteBean.class);
        assertThat(cacheKey.getType()).isEqualTo(CacheType.INSERT);
View Full Code Here

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(null);
        when(generator.prepareInsert(session, meta, pms, noOptions())).thenReturn(ps);

        PreparedStatement actual = manager.getCacheForEntityInsert(session, cache, context, pms);

        assertThat(actual).isSameAs(ps);
        StatementCacheKey cacheKey = cacheKeyCaptor.getValue();
        assertThat(cacheKey.<CompleteBean>getEntityClass()).isSameAs(CompleteBean.class);
        assertThat(cacheKey.getType()).isEqualTo(CacheType.INSERT);
View Full Code Here

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(ps);

        PreparedStatement actual = manager.getCacheForFieldsUpdate(session, cache, context, asList(nameMeta, ageMeta));

        assertThat(actual).isSameAs(ps);
        StatementCacheKey cacheKey = cacheKeyCaptor.getValue();
        assertThat(cacheKey.<CompleteBean>getEntityClass()).isSameAs(CompleteBean.class);
        assertThat(cacheKey.getType()).isEqualTo(CacheType.UPDATE_FIELDS);
View Full Code Here

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(null);
        when(generator.prepareUpdateFields(session, meta, pms, noOptions())).thenReturn(ps);

        PreparedStatement actual = manager.getCacheForFieldsUpdate(session, cache, context, pms);

        assertThat(actual).isSameAs(ps);
        StatementCacheKey cacheKey = cacheKeyCaptor.getValue();
        assertThat(cacheKey.<CompleteBean>getEntityClass()).isSameAs(CompleteBean.class);
        assertThat(cacheKey.getType()).isEqualTo(CacheType.UPDATE_FIELDS);
View Full Code Here

        when(cache.getIfPresent(cacheKey)).thenReturn(null);
        when(generator.prepareCollectionAndMapUpdate(session, meta, changeSet, noOptions())).thenReturn(ps);

        //When
        final PreparedStatement actual = manager.getCacheForCollectionAndMapOperation(session, cache, context, pm, changeSet);

        //Then
        assertThat(actual).isSameAs(ps);
        verify(cache).put(cacheKey, ps);
    }
View Full Code Here

        when(pm.getPropertyName()).thenReturn("property");
        StatementCacheKey cacheKey = new StatementCacheKey(CacheType.ADD_TO_SET, newHashSet("property"), CompleteBean.class, noOptions());
        when(cache.getIfPresent(cacheKey)).thenReturn(ps);

        //When
        final PreparedStatement actual = manager.getCacheForCollectionAndMapOperation(session, cache, context, pm,
                changeSet);

        //Then
        assertThat(actual).isSameAs(ps);
        verify(cache, never()).put(cacheKey, ps);
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.