Examples of cols()


Examples of io.crate.action.sql.SQLBulkResponse.cols()

    private void assertBulkResponseWithTypes(String stmt, Object[][] bulkArgs) {
        SQLBulkRequest request = new SQLBulkRequest(stmt, bulkArgs);
        request.includeTypesOnResponse(true);
        SQLBulkResponse sqlResponse = sqlExecutor.exec(request);
        assertThat(sqlResponse.columnTypes(), is(notNullValue()));
        assertThat(sqlResponse.columnTypes().length, is(sqlResponse.cols().length));
    }

    @Test
    public void testSelectUnknownNoResultWithTypes() throws Exception {
        execute("create table unknown (id integer primary key, name object as (surname string)) " +
View Full Code Here

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

    }

    @Test
    public void testXContentInt() throws Exception {
        SQLResponse r = new SQLResponse();
        r.cols(new String[]{"col1", "col2"});
        r.rows(new Object[][]{new Object[]{1, 2}});
        r.rowCount(1L);
        //System.out.println(json(r));
        JSONAssert.assertEquals(
                "{\"cols\":[\"col1\",\"col2\"],\"rows\":[[1,2]],\"rowcount\":1,\"duration\":-1}",
View Full Code Here

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

    }

    @Test
    public void testXContentString() throws Exception {
        SQLResponse r = new SQLResponse();
        r.cols(new String[]{"some", "thing"});
        r.rows(new Object[][]{
                new Object[]{"one", "two"},
                new Object[]{"three", "four"},
        });
        //System.out.println(json(r));
View Full Code Here

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

    }

    @Test
    public void testXContentRowCount() throws Exception {
        SQLResponse r = new SQLResponse();
        r.cols(new String[]{"some", "thing"});
        r.rows(new Object[][]{
                new Object[]{"one", "two"},
                new Object[]{"three", "four"},
        });
        // If no rowcount is set, -1 is returned
View Full Code Here

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

    }

    @Test
    public void testXContentColumnTypes() throws Exception {
        SQLResponse r = new SQLResponse();
        r.cols(new String[]{"col1", "col2", "col3"});
        r.colTypes(new DataType[]{StringType.INSTANCE, new ArrayType(IntegerType.INSTANCE),
                new SetType(new ArrayType(LongType.INSTANCE))});
        r.includeTypes(true);
        r.rows(new Object[][]{new Object[]{1, new Integer[]{42}, new HashSet<Long[]>(){{add(new Long[]{21L});}}}});
        r.rowCount(1L);
View Full Code Here

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

        BytesStreamOutput o = new BytesStreamOutput();
        SQLResponse r1, r2;

        r1 = new SQLResponse();
        r1.cols(new String[]{});
        r1.colTypes(new DataType[]{});
        r1.rows(new Object[][]{new String[]{}});

        r1.writeTo(o);
View Full Code Here

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

        r2 = new SQLResponse();
        r2.readFrom(new BytesStreamInput(o.bytes()));


        assertArrayEquals(r1.cols(), r2.cols());
        assertArrayEquals(r1.columnTypes(), r2.columnTypes());
        assertArrayEquals(r1.rows(), r2.rows());
        assertEquals(r1.rowCount(), r2.rowCount());

        o.reset();
View Full Code Here

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

        assertArrayEquals(r1.rows(), r2.rows());
        assertEquals(r1.rowCount(), r2.rowCount());

        o.reset();
        r1 = new SQLResponse();
        r1.cols(new String[]{"a", "b"});
        r1.colTypes(new DataType[]{StringType.INSTANCE, StringType.INSTANCE});
        r1.includeTypes(true);
        r1.rows(new Object[][]{new String[]{"va", "vb"}});

        r1.writeTo(o);
View Full Code Here

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

        r1.writeTo(o);

        r2 = new SQLResponse();
        r2.readFrom(new BytesStreamInput(o.bytes()));

        assertArrayEquals(r1.cols(), r2.cols());
        assertArrayEquals(r1.columnTypes(), r2.columnTypes());
        assertArrayEquals(r1.rows(), r2.rows());
        assertEquals(r1.rowCount(), r2.rowCount());

        o.reset();
View Full Code Here

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

        assertEquals(r1.rowCount(), r2.rowCount());

        o.reset();

        r1 = new SQLResponse();
        r1.cols(new String[]{"a", "b"});
        r1.colTypes(new DataType[0]);
        r1.rows(new Object[][]{new String[]{"ab","ba"}, new String[]{"ba", "ab"}});
        r1.rowCount(2L);

        r1.writeTo(o);
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.