Interface PgqlPreparedStatement

All Superinterfaces:
AutoCloseable, PgqlStatement, oracle.pgql.lang.PreparedStatement
All Known Implementing Classes:
PgqlExecution

public interface PgqlPreparedStatement extends PgqlStatement, oracle.pgql.lang.PreparedStatement
This object represents a pre-compiled PGQL statement.

A PGQL statement is precompiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times. Bind variables can be used to efficient execute parameterized queries.

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) = ?";
 PgqlPreparedStatement ps = pgqlConn.prepareStatement(pgqlString);

 ps.setInt(1, 4);
 PgqlResultSet rs = ps.executeQuery();

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

 rs.close();
 ps.close();
 
 

  • Method Details

    • setBoolean

      void setBoolean(int parameterIndex, boolean x)
      Sets the designated parameter to the given Java boolean value.
      Specified by:
      setBoolean in interface oracle.pgql.lang.PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
    • setDouble

      void setDouble(int parameterIndex, double x)
      Sets the designated parameter to the given Java double value.
      Specified by:
      setDouble in interface oracle.pgql.lang.PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
    • setFloat

      void setFloat(int parameterIndex, float x)
      Sets the designated parameter to the given Java float value.
      Specified by:
      setFloat in interface oracle.pgql.lang.PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
    • setInt

      void setInt(int parameterIndex, int x)
      Sets the designated parameter to the given Java int value.
      Specified by:
      setInt in interface oracle.pgql.lang.PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
    • setLong

      void setLong(int parameterIndex, long x)
      Sets the designated parameter to the given Java long value.
      Specified by:
      setLong in interface oracle.pgql.lang.PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
    • setString

      void setString(int parameterIndex, String x)
      Sets the designated parameter to the given Java String value.
      Specified by:
      setString in interface oracle.pgql.lang.PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
    • setTimestamp

      void setTimestamp(int parameterIndex, Timestamp x)
      Sets the designated parameter to the given Java Timestamp value.

      Timestamp values are assumed to be in Coordinated Universal Time (UTC).

      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
    • translateQuery

      PgqlSqlQueryTrans translateQuery() throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a SQL statement.
      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

      default PgqlSqlQueryTrans translateQuery(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:
      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

      PgqlSqlTrans translateStatement() throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a series of SQL statements.
      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 matchOptions, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a series of SQL statements.
      Parameters:
      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(int parallel, int dynamicSampling, int maxResults, String matchOptions, String options) throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Translates this instance's PGQL statement into a series of SQL statements.
      Parameters:
      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

      PgqlResultSet executeQuery() 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.
      Specified by:
      executeQuery in interface oracle.pgql.lang.PreparedStatement
      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(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:
      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() throws PgqlToSqlException, oracle.pgql.lang.PgqlException
      Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.
      Specified by:
      execute in interface oracle.pgql.lang.PreparedStatement
      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 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 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:
      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(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:
      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