Search in sources :

Example 1 with QueryExecutionException

use of org.josql.QueryExecutionException in project camel by apache.

the class SqlBuilder method evaluateQuery.

protected List<?> evaluateQuery(Exchange exchange) {
    configureQuery(exchange);
    Message in = exchange.getIn();
    List<?> list = in.getBody(List.class);
    if (list == null) {
        list = Collections.singletonList(in.getBody());
    }
    try {
        return query.execute(list).getResults();
    } catch (QueryExecutionException e) {
        throw new RuntimeExpressionException(e);
    }
}
Also used : QueryExecutionException(org.josql.QueryExecutionException) Message(org.apache.camel.Message) RuntimeExpressionException(org.apache.camel.RuntimeExpressionException)

Example 2 with QueryExecutionException

use of org.josql.QueryExecutionException in project DirectMemory by raffaeleguidi.

the class OffHeapMemoryBuffer method collectLFU.

public long collectLFU(int limit) {
    if (limit <= 0)
        limit = pointers.size() / 10;
    QueryResults qr;
    try {
        qr = selectOrderBy("free=false", "frequency", "limit 1, " + limit);
        @SuppressWarnings("unchecked") List<Pointer> result = qr.getResults();
        return free(result);
    } catch (QueryParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (QueryExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return 0;
}
Also used : QueryExecutionException(org.josql.QueryExecutionException) QueryResults(org.josql.QueryResults) QueryParseException(org.josql.QueryParseException)

Aggregations

QueryExecutionException (org.josql.QueryExecutionException)2 Message (org.apache.camel.Message)1 RuntimeExpressionException (org.apache.camel.RuntimeExpressionException)1 QueryParseException (org.josql.QueryParseException)1 QueryResults (org.josql.QueryResults)1