Interface PgqlStatement

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
PgqlPreparedStatement
All Known Implementing Classes:
PgqlExecution

public interface PgqlStatement extends AutoCloseable
This interface is used to execute a static PGQL query.

A typical usage is shown below.

 
 PgqlConnection pgqlConn = PgqlConnection.getConnection(conn);
 // If schema is not specified, JDBC Connection schema is used
 pgqlConn.setSchema("SCOTT");
 pgqlConn.setGraph("GRAPH");
 String pgqlString = "SELECT n.name FROM MATCH (n) WHERE id(n) = 1";
 PgqlStatement pgqlStmt = pgqlConn.createStatement();

 PgqlResultSet rs = pgqlStmt.executeQuery(pgqlString);

 while(rs.next()) {
   // process result (e.g., value of name column)
   String nameVal = rs.getString("name");
 }

 rs.close();
 stmt.close();
 
 

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Allows to cancel currently running execute operation.
    void
    Releases this PgqlStatment's database and JDBC resources.
    default boolean
    Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.
    boolean
    execute(String pgql, int parallel, int dynamicSampling, String matchOptions, String options)
    Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.
    boolean
    execute(String pgql, String matchOptions, String options)
    Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.
    Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.
    executeQuery(String pgql, int timeout, int parallel, int dynamicSampling, int maxResults, String options)
    Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.
    executeQuery(String pgql, String options)
    Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.
    int
    Returns the number of commands that should be batched when executing updates
    int
    Returns the the number of rows that should be fetched from the database when more rows are needed for a query result.
    long
    Returns the number of rows that were modified by last execute operation
    Returns the current result as a PgqlResultSet object.
    void
    setBatchSize(int batchSize)
    Sets the number of commands that should be batched when executing updates
    void
    setFetchSize(int fetchSize)
    Sets the number of rows that should be fetched from the database when more rows are needed for a query result.
    Translates this instance's PGQL statement into a SQL statement.
    translateQuery(String pgql, int parallel, int dynamicSampling, int maxResults, String options)
    Translates this instance's PGQL statement into a SQL statement.
    translateQuery(String pgql, String options)
    Translates this instance's PGQL statement into a SQL statement.
    default PgqlSqlTrans
    Translates the given PGQL statement into a series of SQL statements.
    translateStatement(String pgql, int parallel, int dynamicSampling, int maxResults, String matchOptions, String options)
    Translates the given PGQL statement into a series of SQL statements.
    translateStatement(String pgql, String matchOptions, String options)
    Translates the given PGQL statement into a series of SQL statements.
  • Method Details

    • translateQuery

      default PgqlSqlQueryTrans translateQuery(String pgql) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a SQL statement.
      Parameters:
      pgql - the PGQL query to translate
      Returns:
      a PgqlSqlTrans object with the SQL translation and column metadata for the provided PGQL query
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • translateQuery

      PgqlSqlQueryTrans translateQuery(String pgql, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a SQL statement.

      Supported query options are:

      USE_RW=F Use CONNECT BY instead of recursive WITH for unbounded path traversals.

      MAX_PATH_LEN=n Traverse at most n hops when evaluating unbounded path traversals.

      Parameters:
      pgql - the PGQL query to translate
      options - additional options used to influence query translation
      Returns:
      a PgqlSqlTrans object with the SQL translation and column metadata for the provided PGQL query
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • translateQuery

      PgqlSqlQueryTrans translateQuery(String pgql, int parallel, int dynamicSampling, int maxResults, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a SQL statement.

      Supported query options are:

      USE_RW=F Use CONNECT BY instead of recursive WITH for unbounded path traversals.

      MAX_PATH_LEN=n Traverse at most n hops when evaluating unbounded path traversals.

      Parameters:
      pgql - the PGQL query to translate
      parallel - the degree of parallelism to use for query execution
      dynamicSampling - the value for dynamic sampling
      maxResults - the maximum number of rows returned
      options - additional options used to influence query translation
      Returns:
      a PgqlSqlTrans object with the SQL translation and column metadata for the provided PGQL query
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • translateStatement

      default PgqlSqlTrans translateStatement(String pgql) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates the given PGQL statement into a series of SQL statements.
      Parameters:
      pgql - the PGQL statement to translate
      Returns:
      the SQL statements and metadata necessary to execute the provided SQL statement
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • translateStatement

      PgqlSqlTrans translateStatement(String pgql, String matchOptions, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates the given PGQL statement into a series of SQL statements.
      Parameters:
      pgql - the PGQL statement to translate
      matchOptions - additional options used to influence query translation and execution
      options - additional options used to influence DDL/DML translation and execution
      Returns:
      the SQL statements and metadata necessary to execute the provided SQL statement
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • translateStatement

      PgqlSqlTrans translateStatement(String pgql, int parallel, int dynamicSampling, int maxResults, String matchOptions, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates the given PGQL statement into a series of SQL statements.
      Parameters:
      pgql - the PGQL statement to translate
      parallel - the degree of parallelism to use for query execution
      dynamicSampling - the value for dynamic sampling
      maxResults - the maximum number of rows returned
      matchOptions - additional options used to influence query translation and execution
      options - additional options used to influence DDL/DML translation and execution
      Returns:
      the SQL statements and metadata necessary to execute the provided SQL statement
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • executeQuery

      default PgqlResultSet executeQuery(String pgql) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.
      Parameters:
      pgql - the PGQL query to execute
      Returns:
      a PgqlResultSet object with the result of the provided PGQL query
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation or SQL execution
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • executeQuery

      PgqlResultSet executeQuery(String pgql, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.

      Supported query options are:

      USE_RW=F Use CONNECT BY instead of recursive WITH for unbounded path traversals.

      MAX_PATH_LEN=n Traverse at most n hops when evaluating unbounded path traversals.

      Parameters:
      pgql - the PGQL query to execute
      options - additional options used to influence query translation and execution
      Returns:
      a PgqlResultSet object with the result of the provided PGQL query
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation or SQL execution
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • executeQuery

      PgqlResultSet executeQuery(String pgql, int timeout, int parallel, int dynamicSampling, int maxResults, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.

      Supported query options are:

      USE_RW=F Use CONNECT BY instead of recursive WITH for unbounded path traversals.

      MAX_PATH_LEN=n Traverse at most n hops when evaluating unbounded path traversals.

      Parameters:
      pgql - the PGQL query to execute
      timeout - the number of seconds for query execution to finish
      parallel - the degree of parallelism to use for query execution
      dynamicSampling - the value for dynamic sampling
      maxResults - the maximum number of rows returned
      options - additional options used to influence query translation and execution
      Returns:
      a PgqlResultSet object with the result of the provided PGQL query
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation or SQL execution
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • execute

      default boolean execute(String pgql) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.
      Parameters:
      pgql - the PGQL modify to execute
      Returns:
      true if the provided PGQL query is a select, false for other statements
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation or SQL execution
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • execute

      boolean execute(String pgql, String matchOptions, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.

      Supported query options (matchOptions) are the same as those for executeQuery.

      Supported modify options are:

      STREAMING=T Use result sets instead of temporary tables to perform the update.

      AUTO_COMMIT=F Do not commit after performing the modify operation.

      DELETE_CASCADE=F Do not delete incoming/outgoing edges when deleting a vertex.

      Parameters:
      pgql - the PGQL modify to execute
      matchOptions - additional options used to influence query translation and execution
      options - additional options used to influence modify translation and execution
      Returns:
      true if the provided PGQL query is a select, false for other statements
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation or SQL execution
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • execute

      boolean execute(String pgql, int parallel, int dynamicSampling, String matchOptions, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.

      Supported query options (matchOptions) are the same as those for executeQuery.

      Supported modify options are:

      STREAMING=T Use result sets instead of temporary tables to perform the update.

      AUTO_COMMIT=F Do not commit after performing the modify operation.

      DELETE_CASCADE=F Do not delete incoming/outgoing edges when deleting a vertex.

      Parameters:
      pgql - the PGQL modify to execute
      parallel - the degree of parallelism to use for query and update execution
      dynamicSampling - the value for dynamic sampling
      matchOptions - additional options used to influence query translation and execution
      options - additional options used to influence modify translation and execution
      Returns:
      true if the provided PGQL query is a select, false for other statements
      Throws:
      PgqlToSqlException - if a server-side error occurs during translation or SQL execution
      oracle.pgql.lang.PgqlException - if a server-side error occurs or this method is called on a closed Statement
    • getResultSet

      PgqlResultSet getResultSet()
      Returns the current result as a PgqlResultSet object.
      Returns:
      a PgqlResultSet object with the result of the last executed PGQL query, or null if the query last executed PGQL was not a Select statement
    • getModifyCount

      long getModifyCount()
      Returns the number of rows that were modified by last execute operation
      Returns:
      The number of rows modified
    • setBatchSize

      void setBatchSize(int batchSize)
      Sets the number of commands that should be batched when executing updates
      Parameters:
      batchSize - the update batch size
    • setFetchSize

      void setFetchSize(int fetchSize)
      Sets the number of rows that should be fetched from the database when more rows are needed for a query result.
      Parameters:
      fetchSize - the query fetch size
    • getBatchSize

      int getBatchSize()
      Returns the number of commands that should be batched when executing updates
      Returns:
      the update batch size
    • getFetchSize

      int getFetchSize()
      Returns the the number of rows that should be fetched from the database when more rows are needed for a query result.
      Returns:
      the query fetch size
    • close

      void close() throws oracle.pgql.lang.PgqlException
      Releases this PgqlStatment's database and JDBC resources.

      Closing this PgqlStatement will close all PgqlResultSets that were created from it.

      Specified by:
      close in interface AutoCloseable
      Throws:
      oracle.pgql.lang.PgqlException
    • cancel

      void cancel() throws oracle.pgql.lang.PgqlException
      Allows to cancel currently running execute operation. Note that cancel does not rollback already executed modifications.
      Throws:
      oracle.pgql.lang.PgqlException - When an error occurs while canceling current operation.