Package com.datastax.driver.core

Examples of com.datastax.driver.core.RegularStatement


            Utils.joinAndAppend(builder, " AND ", usings.usings, variables);
        }
        builder.append(' ');

        for (int i = 0; i < statements.size(); i++) {
            RegularStatement stmt = statements.get(i);
            if (stmt instanceof BuiltStatement) {
                BuiltStatement bst = (BuiltStatement)stmt;
                builder.append(maybeAddSemicolon(bst.buildQueryString(variables)));

            } else {
                String str = stmt.getQueryString();
                builder.append(str);
                if (!str.trim().endsWith(";"))
                    builder.append(';');

                // Note that we force hasBindMarkers if there is any non-BuiltStatement, so we know
View Full Code Here


            Utils.joinAndAppend(builder, " AND ", usings.usings, variables);
        }
        builder.append(' ');

        for (int i = 0; i < statements.size(); i++) {
            RegularStatement stmt = statements.get(i);
            if (stmt instanceof BuiltStatement) {
                BuiltStatement bst = (BuiltStatement)stmt;
                builder.append(maybeAddSemicolon(bst.buildQueryString(variables)));

            } else {
                String str = stmt.getQueryString();
                builder.append(str);
                if (!str.trim().endsWith(";"))
                    builder.append(';');

                // Note that we force hasBindMarkers if there is any non-BuiltStatement, so we know
View Full Code Here

            PreparedStatement pstmt = ((BoundStatement) statement).preparedStatement();
            queryKeyspace = pstmt.getQueryKeyspace();
            queryString = pstmt.getQueryString();
        }
        else if (statement instanceof RegularStatement) {
            RegularStatement rstmt = (RegularStatement) statement;
            queryKeyspace = rstmt.getKeyspace();
            queryString = rstmt.getQueryString();
        }
        else if (statement instanceof BatchStatement) {
            BatchStatement bstmt = (BatchStatement) statement;
            bstmt.getKeyspace();
            StringBuilder qs = new StringBuilder("\n");
View Full Code Here

            Utils.joinAndAppend(builder, " AND ", usings.usings, variables);
        }
        builder.append(' ');

        for (int i = 0; i < statements.size(); i++) {
            RegularStatement stmt = statements.get(i);
            if (stmt instanceof BuiltStatement) {
                BuiltStatement bst = (BuiltStatement)stmt;
                builder.append(maybeAddSemicolon(bst.buildQueryString(variables)));

            } else {
                String str = stmt.getQueryString();
                builder.append(str);
                if (!str.trim().endsWith(";"))
                    builder.append(';');

                // Note that we force hasBindMarkers if there is any non-BuiltStatement, so we know
View Full Code Here

            Utils.joinAndAppend(builder, " AND ", usings.usings, variables);
        }
        builder.append(' ');

        for (int i = 0; i < statements.size(); i++) {
            RegularStatement stmt = statements.get(i);
            if (stmt instanceof BuiltStatement) {
                BuiltStatement bst = (BuiltStatement)stmt;
                builder.append(maybeAddSemicolon(bst.buildQueryString(variables)));

            } else {
                String str = stmt.getQueryString();
                builder.append(str);
                if (!str.trim().endsWith(";"))
                    builder.append(';');

                // For !BuiltStatement, we know that variables == null since we explicitely set 'hasBindMarkers' below
View Full Code Here

            Utils.joinAndAppend(builder, " AND ", usings.usings, variables);
        }
        builder.append(" ");

        for (int i = 0; i < statements.size(); i++) {
            RegularStatement stmt = statements.get(i);
            if (stmt instanceof BuiltStatement) {
                BuiltStatement bst = (BuiltStatement)stmt;
                builder.append(maybeAddSemicolon(bst.buildQueryString(variables)));

            } else {
                String str = stmt.getQueryString();
                builder.append(str);
                if (!str.trim().endsWith(";"))
                    builder.append(";");

                if (variables != null) {
                    ByteBuffer[] vars = stmt.getValues();
                    if (vars != null) {
                        for (int idx = 0; idx < vars.length; idx++)
                            variables.add(vars[idx]);
                    }
                }
View Full Code Here

        PropertyMeta nameMeta = PropertyMetaTestBuilder.completeBean(Void.class, String.class).propertyName("name").type(SIMPLE).accessors().build();

        EntityMeta meta = buildEntityMeta(idMeta, nameMeta);

        RegularStatement statement = select().from("test");

        initBuilder(statement, meta, meta.getPropertyMetas(), MANAGED);

        when(daoContext.execute(any(AbstractStatementWrapper.class))).thenReturn(futureResultSet);
        when(asyncUtils.transformFuture(futureResultSet, RESULTSET_TO_ROWS, executorService)).thenReturn(futureRows);
View Full Code Here

        PropertyMeta nameMeta = PropertyMetaTestBuilder.completeBean(Void.class, String.class).propertyName("name")
                .type(PropertyType.SIMPLE).accessors().build();

        EntityMeta meta = buildEntityMeta(idMeta, nameMeta);

        RegularStatement statement = select("id").from("test");
        initBuilder(statement, meta, meta.getPropertyMetas(), MANAGED);

        when(daoContext.execute(any(AbstractStatementWrapper.class))).thenReturn(futureResultSet);
        when(asyncUtils.transformFuture(futureResultSet, RESULTSET_TO_ROW, executorService)).thenReturn(futureRow);
        when(asyncUtils.transformFuture(eq(futureRow), rowToEntityCaptor.capture(), eq(executorService))).thenReturn(futureEntity);
View Full Code Here

    }

    @Test
    public void should_support_delete_native_statement_to_batch() throws Exception {
        //Given
        final RegularStatement statement = delete().from("test").where(eq("id", bindMarker("id")));
        ArgumentCaptor<NativeStatementWrapper> statementCaptor = ArgumentCaptor.forClass(NativeStatementWrapper.class);

        //When
        batch.batchNativeStatement(statement, 10L);
View Full Code Here

    @Test
    public void should_create_resource_with_a_distinct_keyspace() throws Exception {
        //Given
        AchillesResource resource = AchillesResourceBuilder.noEntityPackages("test_keyspace");
        final PersistenceManager manager = resource.getPersistenceManager();
        RegularStatement regularStatement = select().countAll().from("system","schema_keyspaces")
                .where(eq("keyspace_name","test_keyspace"));

        //When
        final Map<String,Object> map = manager.nativeQuery(regularStatement).first();
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.