public abstract class DictionaryQueries
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DictionaryQueries.Params
Enumeration of possible parameters that can be used in the list queries.
|
Modifier and Type | Field and Description |
---|---|
static DictionaryQueries.Params[] |
EMPTY_PARAMS |
Constructor and Description |
---|
DictionaryQueries() |
Modifier and Type | Method and Description |
---|---|
boolean |
canUnionListQueries()
Returns true if, when querying multiple object types, the
DictionaryDatabase can UNION together all the list queries to speed up
the query process.
|
protected static java.lang.String |
convertArrayToQuotedList(java.lang.String[] types)
Converts the given list of types into a comma separated list where
each type is quoted.
|
java.lang.String |
getAliveTestStatement()
Returns the statement to execute when testing a connection is alive to
the database.
|
java.lang.String |
getCustomListQuery(java.lang.String type,
boolean defaultSchema,
DBObjectCriteria criteria)
Returns the custom list query for the given object type.
|
DictionaryQueries.Params[] |
getCustomListQueryParams(java.lang.String type,
boolean defaultSchema,
DBObjectCriteria criteria)
Returns the parameters for the custom list query.
|
java.lang.String |
getExistsQuery(java.lang.String type)
Gets a query for finding out whether a partiulcar object (name, type,
schema) exists.
|
DictionaryQueries.Params[] |
getExistsQueryParams(java.lang.String type)
If an exists query exists, this method must return the parameters that
query requires.
|
java.lang.String |
getObjectQueryByID(java.lang.String type)
Returns the query used to retrieve an object's owner and name from the
identifier.
|
DictionaryQueries.Params[] |
getObjectQueryByIDParams(java.lang.String type)
Gets any parameters that are required for the query returned by
getObjectQueryByID(String) . |
java.lang.String |
getObjectStatusQuery(java.lang.String objectType)
Gets the query to test an object's status.
|
DictionaryQueries.Params[] |
getObjectStatusQueryParams(java.lang.String type)
Gets the parameters for the object status query for the given object type.
|
java.lang.String |
getSchemasQuery()
Deprecated.
|
java.lang.String |
getSingleObjectQuery(java.lang.String type,
boolean defaultSchema,
DBObjectCriteria criteria)
If a list is requested and the nameRef does not contain a wildcard we
are therefore expecting a single object.
|
DictionaryQueries.Params[] |
getSingleObjectQueryParams(java.lang.String type,
boolean defaultSchema,
DBObjectCriteria criteria)
Gets the parameters for the query returned by
getSingleObjectQuery(java.lang.String, boolean, oracle.javatools.db.DBObjectCriteria) . |
abstract java.lang.String |
getStandardListQuery(java.lang.String[] types)
Returns the standard list query to use for any type that is supported by
the database (has a builder registered) and is not defined as having a
custom list query.
|
abstract DictionaryQueries.Params[] |
getStandardListQueryParams()
Returns the parameters expected for the standard list query.
|
java.lang.String |
getTimestampQueryByID()
Deprecated.
|
java.lang.String |
getTimestampQueryByID(java.lang.String type)
Returns the query to retrieve the timestampt for an object of given type by
its identifier from the database.
|
java.lang.String |
getTimestampQueryByName(java.lang.String type)
Returns the query to retrieve the timestamp for an object of given type
from the database.
|
abstract java.lang.String |
getUserNameQuery()
Gets a query that returns a single row/column containing the "internal"
name for the connected user.
|
boolean |
isCustomListQuery(java.lang.String type,
boolean defaultSchema,
DBObjectCriteria criteria)
Returns true if the given type has a custom list query - i.e.
|
public static final DictionaryQueries.Params[] EMPTY_PARAMS
public abstract java.lang.String getStandardListQuery(java.lang.String[] types)
The query is expected to return the following columns:
The types are provided so that the standard query can be customised, if necessary. Substitution of the types at this stage is not recommended - use the TYPES or ALL_TYPES Param to do this.
This method can only safely return null if every object type that has a registered builder is defined as having a custom list query.
public abstract DictionaryQueries.Params[] getStandardListQueryParams()
For example, if the standard list query use bind variables and was:
SELECT OBJECT_NAME, OBJECT_TYPE, OBJECT_ID, LAST_DDL_TIME FROM ALL OBJECTS WHERE OWNER = ? AND OBJECT_NAME LIKE ?Then the parameters would be SCHEMA, NAMEREF.
Another example, using message format:
SELECT OBJECT_NAME, OBJECT_TYPE, OBJECT_ID LAST_DDL_TIME FROM ALL OBJECTS WHERE OWNER = ''{0}'' AND OBJECT_NAME LIKE ''{1}'' AND OBJECT_TYPE IN (''{2}'')Then the parameters would be SCHEMA, NAMEREF, TYPES
public boolean isCustomListQuery(java.lang.String type, boolean defaultSchema, DBObjectCriteria criteria)
public java.lang.String getCustomListQuery(java.lang.String type, boolean defaultSchema, DBObjectCriteria criteria)
public DictionaryQueries.Params[] getCustomListQueryParams(java.lang.String type, boolean defaultSchema, DBObjectCriteria criteria)
public java.lang.String getSingleObjectQuery(java.lang.String type, boolean defaultSchema, DBObjectCriteria criteria)
The query is expected to query the same columns as a list query - i.e. name, type, identifier, timestamp.
type
- the object type to getdefaultSchema
- whether the schema being queried is the default
schema for the conectioncriteria
- the full criteria being queriedpublic DictionaryQueries.Params[] getSingleObjectQueryParams(java.lang.String type, boolean defaultSchema, DBObjectCriteria criteria)
getSingleObjectQuery(java.lang.String, boolean, oracle.javatools.db.DBObjectCriteria)
.type
- the object type to getdefaultSchema
- whether the schema being queried is the default
schema for the conectioncriteria
- the full criteria being queriedpublic boolean canUnionListQueries()
public java.lang.String getTimestampQueryByName(java.lang.String type)
The query should take up to three parameters in the given order - schema, object name and object type. It should return one row, with one column, whose value is a valid java.sql.Timestamp.
Returns null if timestamps are not supported.
public java.lang.String getTimestampQueryByID(java.lang.String type)
The query should take one parameter which is the identifier returned as the 3rd column by any of the list queries. It should return one row, with one column, whose value is a valid java.sql.Timestamp.
Returns null if timestamps and/or identifiers are no supported.
@Deprecated public java.lang.String getTimestampQueryByID()
getTimestampQueryByID(String)
@Deprecated public java.lang.String getSchemasQuery()
public abstract java.lang.String getUserNameQuery()
DatabaseMetaData
is incorrect.public java.lang.String getExistsQuery(java.lang.String type)
public DictionaryQueries.Params[] getExistsQueryParams(java.lang.String type)
public java.lang.String getObjectQueryByID(java.lang.String type)
public DictionaryQueries.Params[] getObjectQueryByIDParams(java.lang.String type)
getObjectQueryByID(String)
. By default this returns a single
element array containing Params.IDENTIFIER
.public java.lang.String getAliveTestStatement()
public java.lang.String getObjectStatusQuery(java.lang.String objectType)
objectType
- the object type to querypublic DictionaryQueries.Params[] getObjectStatusQueryParams(java.lang.String type)
type
- the object type the status query is forgetObjectStatusQuery(String)
.protected static java.lang.String convertArrayToQuotedList(java.lang.String[] types)
convertArrayToQuotedList( new String[]{ "TABLE", VIEW" } )will return a String containing:
'TABLE', 'VIEW'
types
- the object types to turn into a comma separated list