Package io.crate.action.sql

Examples of io.crate.action.sql.SQLResponse.rows()


        BytesStreamInput in = new BytesStreamInput(buf, false);
        SQLResponse resp = new SQLResponse();
        resp.readFrom(in);

        assertThat(resp.cols(), is(new String[] { "col1", "col2" }));
        assertThat(resp.rows(), is(new Object[][] {
                new Object[] {"row1_col1", "row1_col2"},
                new Object[] {"row2_col1", "row2_col2"},
        }));

        assertThat(resp.columnTypes(), is(new DataType[] { DataTypes.STRING, DataTypes.STRING }));
View Full Code Here


    @Before
    public void getUpdateIds() {
        if (updateId == null || updateIdqueryPlannerEnabled == null) {
            SQLRequest request = new SQLRequest("SELECT \"_id\" FROM countries WHERE \"countryCode\"=?", new Object[]{"AT"});
            SQLResponse response = getClient(false).execute(SQLAction.INSTANCE, request).actionGet();
            assert response.rows().length == 1;
            updateId = (String)response.rows()[0][0];

            request = new SQLRequest("SELECT \"_id\" FROM countries WHERE \"countryCode\"=?", new Object[]{"AT"});
            response = getClient(true).execute(SQLAction.INSTANCE, request).actionGet();
            assert response.rows().length == 1;
View Full Code Here

    public void getUpdateIds() {
        if (updateId == null || updateIdqueryPlannerEnabled == null) {
            SQLRequest request = new SQLRequest("SELECT \"_id\" FROM countries WHERE \"countryCode\"=?", new Object[]{"AT"});
            SQLResponse response = getClient(false).execute(SQLAction.INSTANCE, request).actionGet();
            assert response.rows().length == 1;
            updateId = (String)response.rows()[0][0];

            request = new SQLRequest("SELECT \"_id\" FROM countries WHERE \"countryCode\"=?", new Object[]{"AT"});
            response = getClient(true).execute(SQLAction.INSTANCE, request).actionGet();
            assert response.rows().length == 1;
            updateIdqueryPlannerEnabled = (String)response.rows()[0][0];
View Full Code Here

            assert response.rows().length == 1;
            updateId = (String)response.rows()[0][0];

            request = new SQLRequest("SELECT \"_id\" FROM countries WHERE \"countryCode\"=?", new Object[]{"AT"});
            response = getClient(true).execute(SQLAction.INSTANCE, request).actionGet();
            assert response.rows().length == 1;
            updateIdqueryPlannerEnabled = (String)response.rows()[0][0];
        }
    }

    public SQLRequest getSqlUpdateByIdRequest(boolean queryPlannerEnabled) {
View Full Code Here

            updateId = (String)response.rows()[0][0];

            request = new SQLRequest("SELECT \"_id\" FROM countries WHERE \"countryCode\"=?", new Object[]{"AT"});
            response = getClient(true).execute(SQLAction.INSTANCE, request).actionGet();
            assert response.rows().length == 1;
            updateIdqueryPlannerEnabled = (String)response.rows()[0][0];
        }
    }

    public SQLRequest getSqlUpdateByIdRequest(boolean queryPlannerEnabled) {
        return new SQLRequest("UPDATE countries SET population=? WHERE \"_id\"=?", new Object[]{ Math.abs(getRandom().nextInt()), queryPlannerEnabled ? updateIdqueryPlannerEnabled : updateId });
View Full Code Here

        if (ids.isEmpty() || countryCodes.isEmpty()) {
            doLoadData();
            // setupOnce non-static
            SQLRequest request = new SQLRequest("SELECT \"_id\", \"countryCode\" FROM countries");
            SQLResponse response = getClient(false).execute(SQLAction.INSTANCE, request).actionGet();
            for (int i=0; i<response.rows().length;i++ ) {
                ids.add((String) response.rows()[i][0]);
                countryCodes.add((String) response.rows()[i][1]);
            }
        }
    }
View Full Code Here

            doLoadData();
            // setupOnce non-static
            SQLRequest request = new SQLRequest("SELECT \"_id\", \"countryCode\" FROM countries");
            SQLResponse response = getClient(false).execute(SQLAction.INSTANCE, request).actionGet();
            for (int i=0; i<response.rows().length;i++ ) {
                ids.add((String) response.rows()[i][0]);
                countryCodes.add((String) response.rows()[i][1]);
            }
        }
    }
View Full Code Here

            // setupOnce non-static
            SQLRequest request = new SQLRequest("SELECT \"_id\", \"countryCode\" FROM countries");
            SQLResponse response = getClient(false).execute(SQLAction.INSTANCE, request).actionGet();
            for (int i=0; i<response.rows().length;i++ ) {
                ids.add((String) response.rows()[i][0]);
                countryCodes.add((String) response.rows()[i][1]);
            }
        }
    }

    public String getDeleteId() throws Exception {
View Full Code Here

        SQLResponse response = execute("select partition_ident from information_schema.table_partitions " +
                "where table_name='quotes' and schema_name='doc'" +
                "order by partition_ident");
        assertThat(response.rowCount(), is(3L));
        assertThat((String)response.rows()[0][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1395874800000"))).ident()));
        assertThat((String)response.rows()[1][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1395961200000"))).ident()));
        assertThat((String)response.rows()[2][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1396303200000"))).ident()));

        execute("delete from quotes where quote = 'Don''t panic'");
        refresh();
View Full Code Here

        SQLResponse response = execute("select partition_ident from information_schema.table_partitions " +
                "where table_name='quotes' and schema_name='doc'" +
                "order by partition_ident");
        assertThat(response.rowCount(), is(3L));
        assertThat((String)response.rows()[0][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1395874800000"))).ident()));
        assertThat((String)response.rows()[1][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1395961200000"))).ident()));
        assertThat((String)response.rows()[2][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1396303200000"))).ident()));

        execute("delete from quotes where quote = 'Don''t panic'");
        refresh();
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.