Search in sources :

Example 1 with BoltQueryExecution

use of org.neo4j.bolt.dbapi.BoltQueryExecution in project neo4j by neo4j.

the class TestFabricTransaction method execute.

@Override
public Result execute(String query, Map<String, Object> parameters) throws QueryExecutionException {
    var ctx = new TestFabricTransactionalContext(kernelInternalTransaction);
    var params = ValueUtils.asParameterMapValue(parameters);
    var result = new ResultSubscriber(ctx, ctx.valueMapper());
    try {
        BoltQueryExecution boltQueryExecution = fabricTransaction.executeQuery(query, params, false, result);
        result.init(boltQueryExecution.getQueryExecution());
    } catch (FabricException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        } else {
            throw new QueryExecutionException(e.getMessage(), e, e.status().code().serialize());
        }
    } catch (QueryExecutionKernelException | Neo4jException e) {
        throw new QueryExecutionException(e.getMessage(), e, e.status().code().serialize());
    }
    return result;
}
Also used : BoltQueryExecution(org.neo4j.bolt.dbapi.BoltQueryExecution) QueryExecutionException(org.neo4j.graphdb.QueryExecutionException) QueryExecutionKernelException(org.neo4j.kernel.impl.query.QueryExecutionKernelException) ResultSubscriber(org.neo4j.cypher.internal.javacompat.ResultSubscriber) FabricException(org.neo4j.fabric.executor.FabricException) Neo4jException(org.neo4j.exceptions.Neo4jException)

Example 2 with BoltQueryExecution

use of org.neo4j.bolt.dbapi.BoltQueryExecution in project neo4j by neo4j.

the class BoltQueryExecutorImpl method executeQuery.

@Override
public BoltQueryExecution executeQuery(String query, MapValue parameters, boolean prePopulate, QuerySubscriber subscriber) throws QueryExecutionKernelException {
    TransactionalContext transactionalContext = transactionalContextFactory.newContext(internalTransaction, query, parameters);
    QueryExecution queryExecution = queryExecutionEngine.executeQuery(query, parameters, transactionalContext, prePopulate, subscriber);
    return new BoltQueryExecutionImpl(queryExecution, transactionalContext);
}
Also used : TransactionalContext(org.neo4j.kernel.impl.query.TransactionalContext) BoltQueryExecution(org.neo4j.bolt.dbapi.BoltQueryExecution) QueryExecution(org.neo4j.kernel.impl.query.QueryExecution)

Aggregations

BoltQueryExecution (org.neo4j.bolt.dbapi.BoltQueryExecution)2 ResultSubscriber (org.neo4j.cypher.internal.javacompat.ResultSubscriber)1 Neo4jException (org.neo4j.exceptions.Neo4jException)1 FabricException (org.neo4j.fabric.executor.FabricException)1 QueryExecutionException (org.neo4j.graphdb.QueryExecutionException)1 QueryExecution (org.neo4j.kernel.impl.query.QueryExecution)1 QueryExecutionKernelException (org.neo4j.kernel.impl.query.QueryExecutionKernelException)1 TransactionalContext (org.neo4j.kernel.impl.query.TransactionalContext)1