Package oracle.pg.rdbms.pgql
Class PgqlConnection
- java.lang.Object
-
- oracle.pg.rdbms.pgql.PgqlConnection
-
public class PgqlConnection extends java.lang.ObjectThis is a class used to createPgqlStatementandPgqlPreparedStatementobjects for executing PGQL queries against graphs stored in Oracle Database.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearGraphMetadataCache()Clear the cache that stores graph metadatavoidclearTranslationCache()Clear the cache that stores translationsPgqlStatementcreateStatement()Creates a new PgqlStatement object, which is used to execute PGQL queriesvoiddisableGraphMetadataCache()Disable the cache that stores graph metadatavoiddisableTranslationCache()Disable the cache that stores translationsvoidenableGraphMetadataCache()Enable the cache that stores graph metadatavoidenableTranslationCache()Enable the cache that stores translationsstatic PgqlConnectiongetConnection(java.sql.Connection conn)Factory method to getPgqlConnectioninstance.java.lang.StringgetGraph()Get the graph name on which PGQL queries will be executed for this connection.longgetGraphMetadataRefreshInterval()get the time interval in milliseconds to determine the frequency to check for graph metadata changes in order to re-cache the necessary metadata for correct query execution.java.sql.ConnectiongetJdbcConnection()Get the JDBC connection that is used to execute PGQL queriesintgetMetadataFetchSize()Get fetch size that is used when loading graph metadatajava.lang.StringgetSchema()Get the schema name that will be used to execute PGQL queries with this connection.PgqlPreparedStatementprepareStatement(java.lang.String pgql)Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.PgqlPreparedStatementprepareStatement(java.lang.String pgql, int timeout, int parallel, int dynamicSampling, int maxResults, java.lang.String matchOptions, java.lang.String options)Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.PgqlPreparedStatementprepareStatement(java.lang.String pgql, java.lang.String matchOptions, java.lang.String options)Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.voidsetGraph(java.lang.String graph)Sets the graph name on which PGQL queries will be executed for this connection.voidsetGraphMetadataCacheMaxCapacity(int maxCapacity)Set max capacity value for the graph metadata cachevoidsetGraphMetadataRefreshInterval(long interval)Set a time interval in milliseconds to determine the frequency to check for graph metadata changes in order to re-cache the necessary metadata for correct query execution.voidsetMetadataFetchSize(int metadataFetchSize)Set fetch size that should be used when loading graph metadatavoidsetSchema(java.lang.String schema)Sets the schema name that will be used to execute PGQL queries with this connection.voidsetTranslationCacheMaxCapacity(int maxCapacity)Set max capacity value for the translation cache
-
-
-
Method Detail
-
getConnection
public static PgqlConnection getConnection(java.sql.Connection conn)
Factory method to getPgqlConnectioninstance.- Parameters:
conn- a JDBC connection- Returns:
- a PgqlConnection instance
-
setSchema
public void setSchema(java.lang.String schema)
Sets the schema name that will be used to execute PGQL queries with this connection.- Parameters:
schema- the name of the schema
-
setGraph
public void setGraph(java.lang.String graph)
Sets the graph name on which PGQL queries will be executed for this connection.- Parameters:
graph- the name of the graph
-
createStatement
public PgqlStatement createStatement()
Creates a new PgqlStatement object, which is used to execute PGQL queries- Returns:
- a new
PgqlStatementobject that can be used to perform PGQL queries
-
prepareStatement
public PgqlPreparedStatement prepareStatement(java.lang.String pgql)
Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.- Parameters:
pgql- the PGQL query to compile- Returns:
- a new
PgqlPreparedStatementobject that can be used to efficiently execute the same query multiple times
-
prepareStatement
public PgqlPreparedStatement prepareStatement(java.lang.String pgql, java.lang.String matchOptions, java.lang.String options)
Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.- Parameters:
pgql- the PGQL query to compilematchOptions- additional options used to influence query translation and executionoptions- additional options used to influence modify translation and execution- Returns:
- a new
PgqlPreparedStatementobject that can be used to efficiently execute the same query multiple times
-
prepareStatement
public PgqlPreparedStatement prepareStatement(java.lang.String pgql, int timeout, int parallel, int dynamicSampling, int maxResults, java.lang.String matchOptions, java.lang.String options)
Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.- Parameters:
pgql- the PGQL query to compiletimeout- the number of seconds for query execution to finishparallel- the degree of parallelism to use for query and modify 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 modify translation and execution- Returns:
- a new
PgqlPreparedStatementobject that can be used to efficiently execute the same query multiple times
-
getSchema
public java.lang.String getSchema() throws PgqlToSqlExceptionGet the schema name that will be used to execute PGQL queries with this connection. If the schema has not been set, the schema from JDBC connection is returned.- Returns:
- the schema set for this connection
- Throws:
PgqlToSqlException- if a database access error occurs or this method is called on a closed connection
-
getGraph
public java.lang.String getGraph()
Get the graph name on which PGQL queries will be executed for this connection.- Returns:
- the graph name for this connection
-
getJdbcConnection
public java.sql.Connection getJdbcConnection()
Get the JDBC connection that is used to execute PGQL queries- Returns:
- the connection
-
clearTranslationCache
public void clearTranslationCache()
Clear the cache that stores translations
-
disableTranslationCache
public void disableTranslationCache()
Disable the cache that stores translations
-
enableTranslationCache
public void enableTranslationCache()
Enable the cache that stores translations
-
setTranslationCacheMaxCapacity
public void setTranslationCacheMaxCapacity(int maxCapacity)
Set max capacity value for the translation cache- Parameters:
maxCapacity- value for max capacity
-
setGraphMetadataRefreshInterval
public void setGraphMetadataRefreshInterval(long interval)
Set a time interval in milliseconds to determine the frequency to check for graph metadata changes in order to re-cache the necessary metadata for correct query execution. Metadata may become outdated if a graph is altered by another user or if a graph is altered by the same user through a separate client instance. Note: refreshing is only triggered upon query execution and would not happen during a period where no queries are executed. If not set, the default interval is 1000 milliseconds.- Parameters:
interval- the time interval in milliseconds to check if refreshing of graph metadata is needed
-
getGraphMetadataRefreshInterval
public long getGraphMetadataRefreshInterval()
get the time interval in milliseconds to determine the frequency to check for graph metadata changes in order to re-cache the necessary metadata for correct query execution.- Returns:
- the time interval in milliseconds to check if refreshing of graph metadata is needed
-
clearGraphMetadataCache
public void clearGraphMetadataCache()
Clear the cache that stores graph metadata
-
disableGraphMetadataCache
public void disableGraphMetadataCache()
Disable the cache that stores graph metadata
-
enableGraphMetadataCache
public void enableGraphMetadataCache()
Enable the cache that stores graph metadata
-
setGraphMetadataCacheMaxCapacity
public void setGraphMetadataCacheMaxCapacity(int maxCapacity)
Set max capacity value for the graph metadata cache- Parameters:
maxCapacity- value for max capacity
-
setMetadataFetchSize
public void setMetadataFetchSize(int metadataFetchSize)
Set fetch size that should be used when loading graph metadata- Parameters:
metadataFetchSize- value for metadata fetch size
-
getMetadataFetchSize
public int getMetadataFetchSize()
Get fetch size that is used when loading graph metadata- Returns:
- the fetch size used when loading graph metadata
-
-