Class AsyncAbstractQueryRunner

java.lang.Object
org.neo4j.driver.internal.async.AsyncAbstractQueryRunner
All Implemented Interfaces:
AsyncQueryRunner
Direct Known Subclasses:
InternalAsyncSession, InternalAsyncTransaction

public abstract class AsyncAbstractQueryRunner extends Object implements AsyncQueryRunner
  • Constructor Details

    • AsyncAbstractQueryRunner

      public AsyncAbstractQueryRunner()
  • Method Details

    • runAsync

      public final CompletionStage<ResultCursor> runAsync(String query, Value parameters)
      Description copied from interface: AsyncQueryRunner
      Run a query asynchronously and return a CompletionStage with a result cursor.

      This method takes a set of parameters that will be injected into the query by Neo4j. Using parameters is highly encouraged, it helps avoid dangerous cypher injection attacks and improves database performance as Neo4j can re-use query plans more often.

      This particular method takes a Value as its input. This is useful if you want to take a map-like value that you've gotten from a prior result and send it back as parameters.

      If you are creating parameters programmatically, AsyncQueryRunner.runAsync(String, Map) might be more helpful, it converts your map to a Value for you.

      Example

       
      
       CompletionStage<ResultCursor> cursorStage = session.runAsync(
                   "MATCH (n) WHERE n.name = $myNameParam RETURN (n)",
                   Values.parameters("myNameParam", "Bob"));
       
       
      It is not allowed to chain blocking operations on the returned CompletionStage. See class javadoc for more information.
      Specified by:
      runAsync in interface AsyncQueryRunner
      Parameters:
      query - text of a Neo4j query
      parameters - input parameters, should be a map Value, see Values.parameters(Object...).
      Returns:
      new CompletionStage that gets completed with a result cursor when query execution is successful. Stage can be completed exceptionally when error happens, e.g. connection can't be acquired from the pool.
    • runAsync

      public final CompletionStage<ResultCursor> runAsync(String query, Map<String,Object> parameters)
      Description copied from interface: AsyncQueryRunner
      Run a query asynchronously and return a CompletionStage with a result cursor.

      This method takes a set of parameters that will be injected into the query by Neo4j. Using parameters is highly encouraged, it helps avoid dangerous cypher injection attacks and improves database performance as Neo4j can re-use query plans more often.

      This version of runAsync takes a Map of parameters. The values in the map must be values that can be converted to Neo4j types. See Values.parameters(Object...) for a list of allowed types.

      Example

       
      
       Map<String, Object> parameters = new HashMap<String, Object>();
       parameters.put("myNameParam", "Bob");
      
       CompletionStage<ResultCursor> cursorStage = session.runAsync(
                   "MATCH (n) WHERE n.name = $myNameParam RETURN (n)",
                   parameters);
       
       
      It is not allowed to chain blocking operations on the returned CompletionStage. See class javadoc for more information.
      Specified by:
      runAsync in interface AsyncQueryRunner
      Parameters:
      query - text of a Neo4j query
      parameters - input data for the query
      Returns:
      new CompletionStage that gets completed with a result cursor when query execution is successful. Stage can be completed exceptionally when error happens, e.g. connection can't be acquired from the pool.
    • runAsync

      public final CompletionStage<ResultCursor> runAsync(String query, Record parameters)
      Description copied from interface: AsyncQueryRunner
      Run a query asynchronously and return a CompletionStage with a result cursor.

      This method takes a set of parameters that will be injected into the query by Neo4j. Using parameters is highly encouraged, it helps avoid dangerous cypher injection attacks and improves database performance as Neo4j can re-use query plans more often.

      This version of runAsync takes a Record of parameters, which can be useful if you want to use the output of one query as input for another.

      It is not allowed to chain blocking operations on the returned CompletionStage. See class javadoc for more information.

      Specified by:
      runAsync in interface AsyncQueryRunner
      Parameters:
      query - text of a Neo4j query
      parameters - input data for the query
      Returns:
      new CompletionStage that gets completed with a result cursor when query execution is successful. Stage can be completed exceptionally when error happens, e.g. connection can't be acquired from the pool.
    • runAsync

      public final CompletionStage<ResultCursor> runAsync(String query)
      Description copied from interface: AsyncQueryRunner
      Run a query asynchronously and return a CompletionStage with a result cursor.

      It is not allowed to chain blocking operations on the returned CompletionStage. See class javadoc for more information.

      Specified by:
      runAsync in interface AsyncQueryRunner
      Parameters:
      query - text of a Neo4j query
      Returns:
      new CompletionStage that gets completed with a result cursor when query execution is successful. Stage can be completed exceptionally when error happens, e.g. connection can't be acquired from the pool.