Package io.crate.action.sql

Examples of io.crate.action.sql.SQLRequest


                        .put("gateway.type", "none")).build();
        node.start();

        SQLService sqlService = node.injector().getInstance(SQLService.class);
        TransportSQLAction transportSQLAction = node.injector().getInstance(TransportSQLAction.class);
        transportSQLAction.execute(new SQLRequest("select name from sys.cluster")).actionGet();

        sqlService.disable();

        try {
            transportSQLAction.execute(new SQLRequest("select name from sys.cluster")).actionGet();
            fail("no exception thrown");
        } catch (NodeDisconnectedException e) {
            // success!
        }

        sqlService.start();
        transportSQLAction.execute(new SQLRequest("select name from sys.cluster")).actionGet();
    }
View Full Code Here


        execute("select * from information_schema.tables");
        assertEquals(15L, response.rowCount());

        client().execute(SQLAction.INSTANCE,
            new SQLRequest("create table t4 (col1 integer, col2 string)")).actionGet();

        // create table causes a cluster event that will then cause to rebuild the information schema
        // wait until it's rebuild
        Thread.sleep(10);

View Full Code Here

            .setSource("{}")
            .execute()
            .actionGet();
        ensureGreen();

        SQLRequest request =  new SQLRequest("select \"_id\" from test");
        request.includeTypesOnResponse(true);
        SQLResponse r = client.sql(request).actionGet();

        assertEquals(1, r.rows().length);
        assertEquals("_id", r.cols()[0]);
        assertEquals("1", r.rows()[0][0]);
View Full Code Here

            internalClient.addTransportAddress(new InetSocketTransportAddress(host, port));
        }
    }

    public ActionFuture<SQLResponse> sql(String stmt) {
        return sql(new SQLRequest(stmt));
    }
View Full Code Here

    public ActionFuture<SQLResponse> sql(SQLRequest request) {
        return internalClient.sql(request);
    }

    public void sql(String stmt, ActionListener<SQLResponse> listener) {
        sql(new SQLRequest(stmt), listener);
    }
View Full Code Here

        assertResponseWithTypes("drop blob table blablob2");
        assertResponseWithTypes("create ANALYZER \"german_snowball\" extends snowball WITH (language='german')");
    }

    private void assertResponseWithTypes(String stmt) {
        SQLRequest request = new SQLRequest(stmt);
        request.includeTypesOnResponse(true);
        SQLResponse sqlResponse = sqlExecutor.exec(request);
        assertThat(sqlResponse.columnTypes(), is(notNullValue()));
        assertThat(sqlResponse.columnTypes().length, is(sqlResponse.cols().length));
    }
View Full Code Here

        Iterator<Client> iterator = clients().iterator();
        Client client1 = iterator.next();
        Client client2 = iterator.next();

        client1.execute(SQLAction.INSTANCE, new SQLRequest(
            "insert into t1 (id, string_field, " +
                "timestamp_field, byte_field) values (?, ?, ?, ?)", new Object[]{1, "With",
            "1970-01-01T00:00:00", 127})).actionGet();

        client2.execute(SQLAction.INSTANCE, new SQLRequest(
            "insert into t1 (id, string_field, timestamp_field, byte_field) values (?, ?, ?, ?)",
            new Object[]{2, "Without", "1970-01-01T01:00:00", Byte.MIN_VALUE})).actionGet();
        refresh();
        SQLResponse response = execute("select id, string_field, timestamp_field, byte_field from t1 order by id");
View Full Code Here

TOP

Related Classes of io.crate.action.sql.SQLRequest

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.