Package com.datastax.driver.core

Examples of com.datastax.driver.core.RegularStatement


                .withClusterings("A", "B")
                .andClusteringsIN("C", "D")
                .async()
                .getOne();

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

        //Then
        assertThat(whereClause.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id AND col1=:col1 AND col2=:col2 AND col3 IN :clusteringKeysIn LIMIT :limitSize;");
        assertThat(start.properties.getBoundValues()).containsSequence("a", "A", "B", asList("C", "D"), 1);
    }
View Full Code Here


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

        start.limit(3).fromClusterings("A", "B").fromExclusiveToInclusiveBounds().orderByDescending().getOne();

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

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

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

        start.limit(3).getMatching("A", "B", "C");

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

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

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

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

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

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

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

        start.limit(3).getFirstMatching(5, "A", "B", "C");

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

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

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

        start.limit(3).async().getFirstMatching(5, "A", "B", "C");

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

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

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

        start.limit(3).getLastMatching(5, "A", "B", "C");

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

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

            throw new IllegalArgumentException(String.format("Cannot prepare statement for property '%s' of entity '%s' because it is a counter type",pm.getPropertyName(),entityMeta.getClassName()));
        } else {
            Selection select = pm.forStatementGeneration().prepareSelectField(select());
            final EntityMetaConfig metaConfig = entityMeta.config();
            Select from = select.from(metaConfig.getKeyspaceName(), metaConfig.getTableName());
            RegularStatement statement = idMeta.forStatementGeneration().generateWhereClauseForSelect(Optional.fromNullable(pm), from);
            return session.prepare(statement.getQueryString());
        }
    }
View Full Code Here

                assignments = pm.forStatementGeneration().prepareUpdateField(updateConditions);
            } else {
                assignments = pm.forStatementGeneration().prepareUpdateField(assignments);
            }
        }
        RegularStatement statement = prepareWhereClauseWithTTLForUpdate(idMeta, assignments, onlyStaticColumns, options);
        return session.prepare(statement.getQueryString());
    }
View Full Code Here

        Optional<PropertyMeta> staticMeta = Optional.absent();
        if (entityMeta.structure().hasOnlyStaticColumns()) {
            staticMeta = Optional.fromNullable(entityMeta.getAllMetasExceptId().get(0));
        }

        RegularStatement statement = idMeta.forStatementGeneration().generateWhereClauseForSelect(staticMeta, from);
        return session.prepare(statement.getQueryString());
    }
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.