public class DbmsUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DB_18C |
static int |
DB_19C |
static int |
DB_20C |
static double |
OPG_20_1 |
static double |
OPG_20_3 |
static double |
OPG_NOT_AVAILABLE |
static double |
OPG_PATCH_NOT_INSTALLED |
static int |
ORA_INVALID_ID |
static int |
ORA_LITERAL_TOO_LONG |
Constructor and Description |
---|
DbmsUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
enquoteTableName(java.sql.Connection conn,
java.lang.String tableName)
Returns a sanitized enquoted table name.
|
static java.lang.String |
escapeAndEnquoteLiteral(java.lang.String str)
Does a SQL escape of single quotes and
enquotes the literal
|
static PgqlResultElement |
getPgqlResultElement(java.sql.ResultSet rs,
PgqlColumnDescriptor colDesc)
Creates and returns a PgqlResultElement object from the passed in
ResultSet object.
|
static java.lang.StringBuffer |
getQueryWrapper(java.lang.String query,
int parallel,
int dynamicSampling)
Wraps the given query to add a hint for parallel and dynamic sampling
|
static java.lang.StringBuffer |
getQueryWrapper(java.lang.String query,
int maxResults,
int parallel,
int dynamicSampling)
Wraps the given query to limit the number of results that will be returned
and also to add a hint for parallel and dynamic sampling
|
static void |
quietlyCloseResultSetAndStmt(java.sql.ResultSet rs,
java.sql.Statement stmt)
Closes (in a best effort fashion) the provided result
set and its corresponding statement.
|
static java.lang.Object |
readObjFromResultSet(java.sql.ResultSet rs,
int idxTypeCol)
Reads a few columns: T, V, VN, VT from the result set and
constructs an Object (V in a K/V pair) depending
on the actual object type.
|
static java.lang.String |
sanitizeGraphName(java.sql.Connection conn,
java.lang.String graphName)
Returns a sanitized version of graphName.
|
static java.lang.String |
sanitizeGraphOwner(java.sql.Connection conn,
java.lang.String ownerName)
Returns a sanitized graph owner name.
|
static java.lang.String |
upperCaseSimpleIdentifier(java.sql.Connection conn,
java.lang.String identifier)
Returns an upper-case version if this is a simple identifier.
|
public static final int DB_18C
public static final int DB_19C
public static final int DB_20C
public static final double OPG_20_1
public static final double OPG_20_3
public static final double OPG_NOT_AVAILABLE
public static final double OPG_PATCH_NOT_INSTALLED
public static final int ORA_INVALID_ID
public static final int ORA_LITERAL_TOO_LONG
public static java.lang.String enquoteTableName(java.sql.Connection conn, java.lang.String tableName) throws java.sql.SQLException
conn
- the database connection (must be an OracleConnection)tableName
- the table name to checkjava.sql.SQLException
- when the given name is illegalpublic static java.lang.String escapeAndEnquoteLiteral(java.lang.String str) throws PgqlToSqlException
str
- the string to escapePgqlToSqlException
public static PgqlResultElement getPgqlResultElement(java.sql.ResultSet rs, PgqlColumnDescriptor colDesc) throws java.sql.SQLException, oracle.pgql.lang.PgqlException
rs
- the JDBC ResultSet to read the query result fromcolDesc
- a descriptor for the expected component valuesjava.sql.SQLException
- when an error occurs getting the objectoracle.pgql.lang.PgqlException
- when the object has an unexpected typepublic static java.lang.StringBuffer getQueryWrapper(java.lang.String query, int parallel, int dynamicSampling)
query
- the query to wrapparallel
- the parallel value to apply if bigger than 0dynamicSampling
- the dynamic sampling value to apply if different
from defaultDspublic static java.lang.StringBuffer getQueryWrapper(java.lang.String query, int maxResults, int parallel, int dynamicSampling)
query
- the query to wrapmaxResults
- the maximum number of results desiredparallel
- the parallel value to apply if bigger than 0dynamicSampling
- the dynamic sampling value to apply if different
from DEFAULT_DSpublic static void quietlyCloseResultSetAndStmt(java.sql.ResultSet rs, java.sql.Statement stmt)
rs
- the result set to closestmt
- the statement to closepublic static java.lang.Object readObjFromResultSet(java.sql.ResultSet rs, int idxTypeCol) throws java.sql.SQLException, oracle.pgql.lang.PgqlException
rs
- a JDBC result setidxTypeCol
- column index (integer) of the data type column (T)java.sql.SQLException
- when an error occurs getting the objectoracle.pgql.lang.PgqlException
- when the object has an unexpected typepublic static java.lang.String sanitizeGraphName(java.sql.Connection conn, java.lang.String graphName) throws java.sql.SQLException, PgqlToSqlException
conn
- the database connection (must be an OracleConnection)graphName
- the graph name to checkjava.sql.SQLException
- when the given name is illegalPgqlToSqlException
- when the given name is not a simple identifierpublic static java.lang.String sanitizeGraphOwner(java.sql.Connection conn, java.lang.String ownerName) throws java.sql.SQLException
conn
- the database connection (must be an OracleConnection)ownerName
- the database user name to checkjava.sql.SQLException
- when the given name is illegalpublic static java.lang.String upperCaseSimpleIdentifier(java.sql.Connection conn, java.lang.String identifier) throws java.sql.SQLException
conn
- the database connection (must be an OracleConnection)identifier
- the database identifier to checkjava.sql.SQLException
- when the given identifier is illegalCopyright © 2015 - 2020 Oracle and/or its affiliates. All Rights Reserved.