Interface PgqlStatement
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Subinterfaces:
PgqlPreparedStatement
- All Known Implementing Classes:
PgqlExecution
public interface PgqlStatement extends java.lang.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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
cancel()
Allows to cancel currently running execute operation.void
close()
Releases this PgqlStatment's database and JDBC resources.default boolean
execute(java.lang.String pgql)
Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.boolean
execute(java.lang.String pgql, 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 pgql, java.lang.String matchOptions, java.lang.String options)
Executes a PGQL Query, Modify or Create/Drop operation on this instance's property graph.default PgqlResultSet
executeQuery(java.lang.String pgql)
Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.PgqlResultSet
executeQuery(java.lang.String pgql, 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.PgqlResultSet
executeQuery(java.lang.String pgql, java.lang.String options)
Translates this instance's PGQL statement into a SQL statement and executes the SQL against this instance's property graph.int
getBatchSize()
Returns the number of commands that should be batched when executing updatesint
getFetchSize()
Returns the the number of rows that should be fetched from the database when more rows are needed for a query result.long
getModifyCount()
Returns the number of rows that were modified by last execute operationPgqlResultSet
getResultSet()
Returns the current result as a PgqlResultSet object.void
setBatchSize(int batchSize)
Sets the number of commands that should be batched when executing updatesvoid
setFetchSize(int fetchSize)
Sets the number of rows that should be fetched from the database when more rows are needed for a query result.default PgqlSqlQueryTrans
translateQuery(java.lang.String pgql)
Translates this instance's PGQL statement into a SQL statement.PgqlSqlQueryTrans
translateQuery(java.lang.String pgql, int parallel, int dynamicSampling, int maxResults, java.lang.String options)
Translates this instance's PGQL statement into a SQL statement.PgqlSqlQueryTrans
translateQuery(java.lang.String pgql, java.lang.String options)
Translates this instance's PGQL statement into a SQL statement.default PgqlSqlTrans
translateStatement(java.lang.String pgql)
Translates the given PGQL statement into a series of SQL statements.PgqlSqlTrans
translateStatement(java.lang.String pgql, int parallel, int dynamicSampling, int maxResults, java.lang.String matchOptions, java.lang.String options)
Translates the given PGQL statement into a series of SQL statements.PgqlSqlTrans
translateStatement(java.lang.String pgql, java.lang.String matchOptions, java.lang.String options)
Translates the given PGQL statement into a series of SQL statements.
-
-
-
Method Detail
-
translateQuery
default PgqlSqlQueryTrans translateQuery(java.lang.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 translationoracle.pgql.lang.PgqlException
- if a server-side error occurs or this method is called on a closed Statement
-
translateQuery
PgqlSqlQueryTrans translateQuery(java.lang.String pgql, 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:
pgql
- the PGQL query to translateoptions
- 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
-
translateQuery
PgqlSqlQueryTrans translateQuery(java.lang.String pgql, 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:
pgql
- the PGQL query to translateparallel
- 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
default PgqlSqlTrans translateStatement(java.lang.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 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 pgql, java.lang.String matchOptions, java.lang.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 translatematchOptions
- 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(java.lang.String pgql, int parallel, int dynamicSampling, int maxResults, java.lang.String matchOptions, java.lang.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 translateparallel
- 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
default PgqlResultSet executeQuery(java.lang.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 executionoracle.pgql.lang.PgqlException
- if a server-side error occurs or this method is called on a closed Statement
-
executeQuery
PgqlResultSet executeQuery(java.lang.String pgql, 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:
pgql
- the PGQL query to executeoptions
- 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
-
executeQuery
PgqlResultSet executeQuery(java.lang.String pgql, 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:
pgql
- the PGQL query to executetimeout
- 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(java.lang.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 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 pgql, 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:
pgql
- the PGQL modify to executematchOptions
- 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(java.lang.String pgql, 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:
pgql
- the PGQL modify to executeparallel
- 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
-
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 interfacejava.lang.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.
-
-