Package com.datastax.driver.core.querybuilder.Select

Examples of com.datastax.driver.core.querybuilder.Select.Selection.from()


        if (pm.structure().isCounter()) {
            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


        Selection select = select();

        for (PropertyMeta pm : entityMeta.forOperations().getColumnsMetaToLoad()) {
            select = pm.forStatementGeneration().prepareSelectField(select);
        }
        Select from = select.from(metaConfig.getKeyspaceName(), metaConfig.getTableName());

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

        for (PropertyMeta pm : entityMeta.forOperations().getColumnsMetaToLoad()) {
            select = pm.forStatementGeneration().prepareSelectField(select);
        }

        Select from = select.from(metaConfig.getKeyspaceName(), metaConfig.getTableName());

        final RegularStatement whereClause = sliceQueryProperties.generateWhereClauseForSelect(from);

        return session.prepare(whereClause.getQueryString());
    }
View Full Code Here

        //When
        final Selection actual = view.prepareSelectField(select);

        //Then
        assertThat(actual.from("table").getQueryString()).isEqualTo("SELECT id,name FROM table;");
    }

    @Test
    public void should_prepare_select_fields_for_id() throws Exception {
        //Given
View Full Code Here

        //When
        final Selection actual = view.prepareSelectField(select);

        //Then
        assertThat(actual.from("table").getQueryString()).isEqualTo("SELECT id FROM table;");
    }

    @Test
    public void should_generate_update_for_remove_all() throws Exception {
        //Given
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.