Package com.datastax.driver.core

Examples of com.datastax.driver.core.RegularStatement


        //When
        final IterateFromPartition<String> start = builder.withPartitionComponents("a");

        start.limit(3).iterator();

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", 3);
        assertThat(start.properties.fetchSizeO.isPresent()).isFalse();
    }
View Full Code Here


        //When
        final IterateFromPartition<String> start = builder.withPartitionComponents("a");

        start.limit(3).orderByAscending().async().iterator(11);

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id ORDER BY col1 ASC LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", 3);
        assertThat(start.properties.fetchSizeO.get()).isEqualTo(11);
    }
View Full Code Here

        //When
        final IterateWithPartition<String> start = builder.withPartitionComponentsIN("a", "b");

        start.fromClusterings("A", "B").limit(3).iterator(10);

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE bucket IN :partitionComponentsIn AND (col1,col2)>=(:col1,:col2) LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence(asList("a", "b"), "A", "B", 3);
        assertThat(start.properties.fetchSizeO.get()).isEqualTo(10);
    }
View Full Code Here

        //When
        final IterateFromPartition<String> start = builder.withPartitionComponents("a");

        start.limit(3).iterator(120);

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", 3);
        assertThat(start.properties.fetchSizeO.get()).isEqualTo(120);
    }
View Full Code Here

        //When
        final IterateFromPartition<String> start = builder.withPartitionComponents("a");

        start.limit(3).async().iterator(120);

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", 3);
        assertThat(start.properties.fetchSizeO.get()).isEqualTo(120);
    }
View Full Code Here

        //When
        final IterateFromPartition<String> start = builder.withPartitionComponents("a");

        start.limit(3).iteratorWithMatching("A", "B");

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id AND col1=:col1 AND col2=:col2 LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", "A", "B", 3);
        assertThat(start.properties.fetchSizeO.isPresent()).isFalse();
    }
View Full Code Here

        //When
        final IterateFromPartition<String> start = builder.withPartitionComponents("a");

        start.limit(3).async().iteratorWithMatching("A", "B");

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id AND col1=:col1 AND col2=:col2 LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", "A", "B", 3);
        assertThat(start.properties.fetchSizeO.isPresent()).isFalse();
    }
View Full Code Here

        //When
        final IterateFromPartition<String> start = builder.withPartitionComponents("a");

        start.limit(3).orderByAscending().iteratorWithMatchingAndBatchSize(123, "A", "B");

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id AND col1=:col1 AND col2=:col2 ORDER BY col1 ASC LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", "A", "B", 3);
        assertThat(start.properties.fetchSizeO.get()).isEqualTo(123);
    }
View Full Code Here

        //When
        final IterateFromPartition<String> start = builder.withPartitionComponents("a");

        start.limit(3).orderByDescending().async().iteratorWithMatchingAndBatchSize(123, "A", "B");

        final RegularStatement whereClause = start.properties.generateWhereClauseForSelect(select);

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id AND col1=:col1 AND col2=:col2 ORDER BY col1 DESC LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", "A", "B", 3);
        assertThat(start.properties.fetchSizeO.get()).isEqualTo(123);
    }
View Full Code Here

        final List<Object> clusteringKeysIN = Arrays.<Object>asList(PropertyType.LIST, PropertyType.SET);

        final Select select = select().from("table");

        //When
        final RegularStatement statement = SliceQueryProperties.builder(meta, ClusteredEntity.class, SliceType.SELECT)
                .partitionKeysName(asList("id", "bucket")).lastPartitionKeyName("year")
                .partitionKeys(partitionKeys).andPartitionKeysIn(partitionKeysIN)
                .withClusteringKeysName(asList("date")).lastClusteringKeyName("type")
                .withClusteringKeys(clusteringKeys).andClusteringKeysIn(clusteringKeysIN)
                .ordering(OrderingMode.DESCENDING)
                .limit(12)
                .generateWhereClauseForSelect(select);

        //Then
        assertThat(statement.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id AND bucket=:bucket AND year IN :partitionComponentsIn AND date=:date AND type IN :clusteringKeysIn ORDER BY date DESC LIMIT :limitSize;");
    }
View Full Code Here

TOP

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

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.