Interface PgqlPreparedStatement
-
- All Superinterfaces:
java.lang.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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
execute()
Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.boolean
execute(int parallel, int dynamicSampling, java.lang.String matchOptions, java.lang.String options)
Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.boolean
execute(java.lang.String matchOptions, java.lang.String options)
Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.PgqlResultSet
executeQuery()
Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.PgqlResultSet
executeQuery(int timeout, int parallel, int dynamicSampling, int maxResults, java.lang.String options)
Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.void
setBoolean(int parameterIndex, boolean x)
Sets the designated parameter to the given Java boolean value.void
setDouble(int parameterIndex, double x)
Sets the designated parameter to the given Java double value.void
setFloat(int parameterIndex, float x)
Sets the designated parameter to the given Java float value.void
setInt(int parameterIndex, int x)
Sets the designated parameter to the given Java int value.void
setLong(int parameterIndex, long x)
Sets the designated parameter to the given Java long value.void
setString(int parameterIndex, java.lang.String x)
Sets the designated parameter to the given Java String value.void
setTimestamp(int parameterIndex, java.sql.Timestamp x)
Sets the designated parameter to the given Java Timestamp value.PgqlSqlQueryTrans
translateQuery()
Translates this instance's PGQL statement into a SQL statement.default PgqlSqlQueryTrans
translateQuery(int parallel, int dynamicSampling, int maxResults, java.lang.String options)
Translates this instance's PGQL statement into a SQL statement.PgqlSqlTrans
translateStatement()
Translates this instance's PGQL statement into a series of SQL statements.PgqlSqlTrans
translateStatement(int parallel, int dynamicSampling, int maxResults, java.lang.String matchOptions, java.lang.String options)
Translates this instance's PGQL statement into a series of SQL statements.PgqlSqlTrans
translateStatement(java.lang.String matchOptions, java.lang.String options)
Translates this instance's PGQL statement into a series of SQL statements.-
Methods inherited from interface oracle.pg.rdbms.pgql.PgqlStatement
cancel, close, execute, execute, execute, executeQuery, executeQuery, executeQuery, getBatchSize, getFetchSize, getModifyCount, getResultSet, setBatchSize, setFetchSize, translateQuery, translateQuery, translateQuery, translateStatement, translateStatement, translateStatement
-
-
-
-
Method Detail
-
setBoolean
void setBoolean(int parameterIndex, boolean x)
Sets the designated parameter to the given Java boolean value.- Specified by:
setBoolean
in interfaceoracle.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 interfaceoracle.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 interfaceoracle.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 interfaceoracle.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 interfaceoracle.pgql.lang.PreparedStatement
- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
-
setString
void setString(int parameterIndex, java.lang.String x)
Sets the designated parameter to the given Java String value.- Specified by:
setString
in interfaceoracle.pgql.lang.PreparedStatement
- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
-
setTimestamp
void setTimestamp(int parameterIndex, java.sql.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 translationoracle.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, java.lang.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 executiondynamicSampling
- the value for dynamic samplingmaxResults
- the maximum number of rows returnedoptions
- 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 translationoracle.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 translationoracle.pgql.lang.PgqlException
- if a server-side error occurs or this method is called on a closed Statement
-
translateStatement
PgqlSqlTrans translateStatement(java.lang.String matchOptions, java.lang.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 executionoptions
- 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 translationoracle.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, java.lang.String matchOptions, java.lang.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 executiondynamicSampling
- the value for dynamic samplingmaxResults
- the maximum number of rows returnedmatchOptions
- additional options used to influence query translation and executionoptions
- 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 translationoracle.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 interfaceoracle.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 executionoracle.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, java.lang.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 finishparallel
- the degree of parallelism to use for query executiondynamicSampling
- the value for dynamic samplingmaxResults
- the maximum number of rows returnedoptions
- 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 executionoracle.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 interfaceoracle.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 executionoracle.pgql.lang.PgqlException
- if a server-side error occurs or this method is called on a closed Statement
-
execute
boolean execute(java.lang.String matchOptions, java.lang.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 executionoptions
- 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 executionoracle.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, java.lang.String matchOptions, java.lang.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 executiondynamicSampling
- the value for dynamic samplingmatchOptions
- additional options used to influence query translation and executionoptions
- 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 executionoracle.pgql.lang.PgqlException
- if a server-side error occurs or this method is called on a closed Statement
-
-