Search in sources :

Example 1 with QueryResultBuilder

use of org.apache.cayenne.util.QueryResultBuilder in project cayenne by apache.

the class MappedExec method execute.

public QueryResult execute(ObjectContext context) {
    // TODO: switch ObjectContext to QueryResult instead of QueryResponse
    // and create its own 'exec' method
    QueryResponse response = context.performGenericQuery(this);
    QueryResultBuilder builder = QueryResultBuilder.builder(response.size());
    for (response.reset(); response.next(); ) {
        if (response.isList()) {
            builder.addSelectResult(response.currentList());
        } else {
            builder.addBatchUpdateResult(response.currentUpdateCount());
        }
    }
    return builder.build();
}
Also used : QueryResultBuilder(org.apache.cayenne.util.QueryResultBuilder) QueryResponse(org.apache.cayenne.QueryResponse)

Example 2 with QueryResultBuilder

use of org.apache.cayenne.util.QueryResultBuilder in project cayenne by apache.

the class SQLExec method execute.

public QueryResult execute(ObjectContext context) {
    // TODO: switch ObjectContext to QueryResult instead of QueryResponse
    // and create its own 'exec' method
    QueryResponse response = context.performGenericQuery(this);
    QueryResultBuilder builder = QueryResultBuilder.builder(response.size());
    for (response.reset(); response.next(); ) {
        if (response.isList()) {
            builder.addSelectResult(response.currentList());
        } else {
            builder.addBatchUpdateResult(response.currentUpdateCount());
        }
    }
    return builder.build();
}
Also used : QueryResultBuilder(org.apache.cayenne.util.QueryResultBuilder) QueryResponse(org.apache.cayenne.QueryResponse)

Aggregations

QueryResponse (org.apache.cayenne.QueryResponse)2 QueryResultBuilder (org.apache.cayenne.util.QueryResultBuilder)2