Interface PgqlPreparedStatement
- All Superinterfaces:
AutoCloseable,PgqlStatement,oracle.pgql.lang.PreparedStatement
- All Known Implementing Classes:
PgqlExecution
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
Modifier and TypeMethodDescriptiondefault booleanexecute()Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.booleanExecutes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.booleanExecutes 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(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.voidsetBoolean(int parameterIndex, boolean x) Sets the designated parameter to the given Java boolean value.voidsetDouble(int parameterIndex, double x) Sets the designated parameter to the given Java double value.voidsetFloat(int parameterIndex, float x) Sets the designated parameter to the given Java float value.voidsetInt(int parameterIndex, int x) Sets the designated parameter to the given Java int value.voidsetLong(int parameterIndex, long x) Sets the designated parameter to the given Java long value.voidSets the designated parameter to the given Java String value.voidsetTimestamp(int parameterIndex, Timestamp x) Sets the designated parameter to the given Java Timestamp value.Translates this instance's PGQL statement into a SQL statement.default PgqlSqlQueryTranstranslateQuery(int parallel, int dynamicSampling, int maxResults, String options) Translates this instance's PGQL statement into a SQL statement.Translates this instance's PGQL statement into a series of SQL statements.translateStatement(int parallel, int dynamicSampling, int maxResults, String matchOptions, String options) Translates this instance's PGQL statement into a series of SQL statements.translateStatement(String matchOptions, 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, translateStatementMethods inherited from interface oracle.pgql.lang.PreparedStatement
close, getResultSet, setArray, setDate, setTime, setTimestamp, setTimestampWithTimezone, setTimeWithTimezone
-
Method Details
-
setBoolean
void setBoolean(int parameterIndex, boolean x) Sets the designated parameter to the given Java boolean value.- Specified by:
setBooleanin 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:
setDoublein 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:
setFloatin 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:
setIntin 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:
setLongin interfaceoracle.pgql.lang.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value
-
setString
Sets the designated parameter to the given Java String value.- Specified by:
setStringin interfaceoracle.pgql.lang.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value
-
setTimestamp
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
Translates this instance's PGQL statement into a SQL statement.- Returns:
- a
PgqlSqlTransobject 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, 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
PgqlSqlTransobject 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
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(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 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, 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 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
Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.- Specified by:
executeQueryin interfaceoracle.pgql.lang.PreparedStatement- Returns:
- a
PgqlResultSetobject 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, 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
PgqlResultSetobject 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
Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.- Specified by:
executein 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(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 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, 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 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
-