Package io.crate.action.sql

Examples of io.crate.action.sql.SQLRequest


                .field("population", 1000)
                .endObject().string();
    }

    private SQLRequest getSingleSqlInsertRequest() {
        return new SQLRequest(SINGLE_INSERT_SQL_STMT,
                new Object[]{"Mordor", "MO", "666", 0.0, 180.0, 90.0, 0.0,
                             "MOR", "NAZ", "ME", "Mittelerde", "naz", "MOR",
                             "Schicksalsberg", 1000 }
        );
    }
View Full Code Here


                             "Schicksalsberg", 1000 }
        );
    }

    private SQLRequest getBulkSqlInsertRequest() {
        return new SQLRequest(BULK_INSERT_SQL_STMT,
                new Object[]{
                        "Mordor", "MO", "666", 0.0, 180.0, 90.0, 0.0,
                        "MOR", "NAZ", "ME", "Mittelerde", "naz", "MOR",
                        "Schicksalsberg", 1000,
View Full Code Here

    @Rule
    public TestRule ruleChain = RuleChain.emptyRuleChain();

    public SQLResponse execute(String stmt, Object[] args, boolean queryPlannerEnabled) {
        return getClient(queryPlannerEnabled).execute(SQLAction.INSTANCE, new SQLRequest(stmt, args)).actionGet();
    }
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;
            updateIdqueryPlannerEnabled = (String)response.rows()[0][0];
        }
    }
View Full Code Here

            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

        updateDoc.put("population", Math.abs(getRandom().nextInt()));
        return new UpdateRequest(INDEX_NAME, "default", queryPlannerEnabled ? updateIdqueryPlannerEnabled : updateId).doc(updateDoc);
    }

    public SQLRequest getSqlUpdateRequest() {
        return new SQLRequest("UPDATE countries SET population=? WHERE \"countryCode\"=?", new Object[]{ Math.abs(getRandom().nextInt()), "US" });
    }
View Full Code Here

    @Test
    public void testSQLSingleDelete() {
        HashMap<String, String> ids = createSampleData();
        for(String id: ids.keySet()){
            getClient(false).execute(SQLAction.INSTANCE,
                                     new SQLRequest(DELETE_SQL_STMT, new Object[]{id})).actionGet();
        }
    }
View Full Code Here

    @Before
    public void prepare() throws Exception {
        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

    public DeleteRequest getDeleteApiByIdRequest() throws Exception {
        return new DeleteRequest(INDEX_NAME, "default", getDeleteId());
    }

    public SQLRequest getDeleteSqlByIdRequest() throws Exception {
        return new SQLRequest("DELETE FROM countries WHERE \"_id\"=?", new Object[]{ getDeleteId() });
    }
View Full Code Here

    public SQLRequest getDeleteSqlByIdRequest() throws Exception {
        return new SQLRequest("DELETE FROM countries WHERE \"_id\"=?", new Object[]{ getDeleteId() });
    }

    public SQLRequest getDeleteSqlByQueryRequest() throws Exception {
        return new SQLRequest("DELETE FROM countries WHERE \"countryCode\"=?", new Object[]{ getCountryCode() });
    }
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.