Package io.crate.action.sql

Examples of io.crate.action.sql.SQLBulkRequest


            String id = (String)object[0];
            Id esId = new Id(ImmutableList.of(new ColumnIdent("id")), ImmutableList.of(new BytesRef(id)), new ColumnIdent("id"), true);
            ids.put(id, esId.stringValue());
        }
        SQLBulkRequest request = new SQLBulkRequest(SINGLE_INSERT_SQL_STMT, bulkArgs);
        client().execute(SQLBulkAction.INSTANCE, request).actionGet();
        refresh(client());
        return ids;
    }
View Full Code Here


        int i = 0;
        for(String id: ids.keySet()){
            bulkArgs[i] = new Object[]{id};
            i++;
        }
        getClient(false).execute(SQLBulkAction.INSTANCE, new SQLBulkRequest(DELETE_SQL_STMT, bulkArgs)).actionGet();
        refresh(client());
    }
View Full Code Here

        client.sql("create table test (a string, b int) with (number_of_replicas=0)").actionGet();
        ensureGreen();
        client.sql("insert into test (a, b) values ('foo', 1)").actionGet();
        client.sql("refresh table test").actionGet();

        SQLBulkRequest bulkRequest = new SQLBulkRequest(
                "update test set a = ? where b = ?",
                new Object[][]{new Object[]{"bar", 1}, new Object[]{"baz", 1}});
        SQLBulkResponse bulkResponse = client.bulkSql(bulkRequest).actionGet();
        assertThat(bulkResponse.results().length, is(2));
        for (SQLBulkResponse.Result result : bulkResponse.results()) {
View Full Code Here

                        new Object[]{2, "Trillian"}
                });
    }

    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));
    }
View Full Code Here

TOP

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

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.