Package io.crate.action.sql.parser

Examples of io.crate.action.sql.parser.SQLXContentSourceContext.args()


            requestBuilder.stmt(context.stmt());
            requestBuilder.includeTypesOnResponse(includeTypes);
            sqlResponse = requestBuilder.execute().actionGet();
        } else {
            SQLRequestBuilder requestBuilder = new SQLRequestBuilder(client());
            requestBuilder.args(context.args());
            requestBuilder.stmt(context.stmt());
            requestBuilder.includeTypesOnResponse(includeTypes);
            sqlResponse = requestBuilder.execute().actionGet();
        }
        sqlResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
View Full Code Here


            channel.sendResponse(new CrateThrowableRestResponse(channel,
                    new SQLActionException(e.getMessage(), 4000, RestStatus.BAD_REQUEST, stackTrace.toString())));
            return;
        }

        Object[] args = context.args();
        Object[][] bulkArgs = context.bulkArgs();
        if(args != null && args.length > 0 && bulkArgs != null && bulkArgs.length > 0){
            channel.sendResponse(new CrateThrowableRestResponse(channel,
                    new SQLActionException("request body contains args and bulk_args. It's forbidden to provide both",
                            4000, RestStatus.BAD_REQUEST, null)));
View Full Code Here

        parser.parseSource(source);

        ObjectMapper mapper = new ObjectMapper();
        assertEquals(
            "[[\"1\",\"2\"],\"1\",1,2,2.0,99999999999999999999999999999999]",
            mapper.writeValueAsString(context.args()));
    }

    @Test
    public void testArgsParserNestedList() throws Exception {
View Full Code Here

            "    \"args\": [[\"1\", \"2\", [\"1\"]], \"1\", 1, 2, 2.0, 99999999999999999999999999999999]\n" +
            "}\n");
        parser.parseSource(source);
        ObjectMapper mapper = new ObjectMapper();
        assertEquals("[[\"1\",\"2\",[\"1\"]],\"1\",1,2,2.0,99999999999999999999999999999999]",
            mapper.writeValueAsString(context.args()));
    }

    @Test
    public void testArgsParserNestedMap() throws Exception {
View Full Code Here

            "    \"stmt\": \"select * from locations where id = $2\",\n" +
            "    \"args\": [{\"1\": \"2\"}, 1]\n" +
            "}\n");
        parser.parseSource(source);
        ObjectMapper mapper = new ObjectMapper();
        assertEquals("[{\"1\":\"2\"},1]", mapper.writeValueAsString(context.args()));
    }

    @Test
    public void testArgsParserVeryNestedMap() throws Exception {

View Full Code Here

            "    \"args\": [{\"1\": {\"2\": {\"3\": 3}}}, [{\"1\": {\"2\": [2, 2]}}]]\n" +
            "}\n");
        parser.parseSource(source);
        ObjectMapper mapper = new ObjectMapper();
        assertEquals("[{\"1\":{\"2\":{\"3\":3}}},[{\"1\":{\"2\":[2,2]}}]]",
            mapper.writeValueAsString(context.args()));
    }

    @Test
    public void testSqlRequestWithBulkArgs() throws Exception {
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.