Package | Description |
---|---|
oracle.javatools.db.sql |
Contains an API for declaratively parsing SQL queries (SELECT statements).
|
Modifier and Type | Class and Description |
---|---|
class |
AliasInUseException
SQLQueryException thrown when an attempt is made to add an object whose alias is already in use.
|
class |
AmbiguousColumnException
Exception thrown when the name of a column in a query is ambiguous - i.e.
|
class |
IDException
Exception thrown when a DBObject is missing an ID.
|
class |
InvalidAliasException
Exception thrown when a select or from object has an invalid alias (e.g.
|
class |
InvalidSQLException
SQLQueryException for representing errors in the sql (e.g.
|
class |
SQLParseException
Subclass of SQLQueryException used for parse errors in the sql.
|
class |
SQLQueryClauseException
Exception thrown by a SQLQueryBuilder when there is an error with a clause in the query, but that this error doesn't stop the query being declarative.
|
Modifier and Type | Method and Description |
---|---|
<T extends SQLQueryException> |
AbstractSQLQueryBuilder.throwException(T sqe)
Method that takes a SQLQueryException and rethrows it unless it is a SQLQueryClauseException and we are in the middle of a build.
|
Modifier and Type | Method and Description |
---|---|
void |
SQLQueryBuilder.addFromObject(FromObject from)
Adds the given FromObject to the query.
|
void |
AbstractSQLQueryBuilder.addFromObject(FromObject from) |
void |
SQLQueryBuilder.addSelectObject(int index, SelectObject select)
Inserts the given SelectObject to the query at the given index.
|
void |
AbstractSQLQueryBuilder.addSelectObject(int index, SelectObject select) |
void |
SQLQueryBuilder.addSelectObject(SelectObject select)
Adds the given SelectObject to the query.
|
void |
AbstractSQLQueryBuilder.addSelectObject(SelectObject select) |
void |
SQLQueryBuilder.addSetOperatorObject(SetOperator select)
Adds the given SetOperator to the query.
|
void |
AbstractSQLQueryBuilder.buildDeclarativeProperties(SQLQuery query)
DerivedPropertyBuilder mechanism that directly builds the derived properties on the given SQLQuery.
|
void |
SQLQueryBuilder.buildQuery(SQLQuery query)
Builds the query based on the given SQLQuery.
|
void |
AbstractSQLQueryBuilder.buildQuery(SQLQuery query) |
void |
SQLQueryBuilder.buildQuery(java.lang.String select)
Builds the query based on the given select statement.
|
void |
AbstractSQLQueryBuilder.buildQuery(java.lang.String sql)
Builds a query object from the given sql expression.
|
void |
SQLQueryBuilder.buildQuery(java.lang.String select, SQLQueryOwner owner)
Builds the query based on the given select statement.
|
void |
AbstractSQLQueryBuilder.buildQuery(java.lang.String sql, SQLQueryOwner parent)
Builds a query from the given sql expression.
|
protected abstract void |
AbstractSQLQueryBuilder.buildQueryImpl(java.lang.String sql, SQLQuery query, SQLQueryOwner parent)
Builds the declarative components of the given SQLQuery based on the given select statement.
|
static void |
ParserUtils.checkErrors(PlsqlRoot root, java.lang.String sql)
Deprecated.
|
SQLQueryBuilder.SQLQueryObjectSet |
SQLQueryBuilder.constructFKJoin(FKConstraint fk, FromObject left, FromObject right)
Creates a JOIN in the query's FROM clause to represent the given FKConstraint.
|
SQLQueryBuilder.SQLQueryObjectSet |
AbstractSQLQueryBuilder.constructFKJoin(FKConstraint fk, FromObject left, FromObject right) |
SQLQueryBuilder.SQLQueryObjectSet |
SQLQueryBuilder.constructFKJoins(FKConstraint[] fks, FromObject[] usagesToUse)
Creates a set of nested JOINs in the query's FROM clause to represent each given FKConstraint.
|
SQLQueryBuilder.SQLQueryObjectSet |
AbstractSQLQueryBuilder.constructFKJoins(FKConstraint[] fks, FromObject[] usagesToUse) |
SQLQueryBuilder.SQLQueryObjectSet |
SQLQueryBuilder.constructFromObject(SchemaObject relation, boolean createSelectObjects, boolean createJoins, FromObject[] includeInJoins)
Creates a FromObject for the query.
|
SQLQueryBuilder.SQLQueryObjectSet |
AbstractSQLQueryBuilder.constructFromObject(SchemaObject relation, boolean createSelectObjects, boolean createJoins, FromObject[] includeInJoins) |
FromObject |
SQLQueryBuilder.constructFromObject(java.lang.String expression, java.lang.String alias)
Creates a FromObject using the given alias and expression, parsing the expression into an appropriate set of SQLFragments.
|
FromObject |
AbstractSQLQueryBuilder.constructFromObject(java.lang.String expression, java.lang.String alias) |
SQLQueryBuilder.SQLQueryObjectSet |
SQLQueryBuilder.constructFromObjects(Relation[] baseRelations, boolean createSelectObjects, boolean createJoins, FromObject[] includeInJoins)
Creates one or more FromObjects for the query.
|
SQLQueryBuilder.SQLQueryObjectSet |
AbstractSQLQueryBuilder.constructFromObjects(Relation[] baseRelations, boolean createSelectObjects, boolean createJoins, FromObject[] includeInJoins) |
SQLQueryBuilder.SQLQueryObjectSet |
SQLQueryBuilder.constructSelectObject(Column col, FromObject usageToUse)
Creates a SelectObject for the query based on the column passed in.
|
SQLQueryBuilder.SQLQueryObjectSet |
AbstractSQLQueryBuilder.constructSelectObject(Column col, FromObject usageToUse) |
SelectObject |
SQLQueryBuilder.constructSelectObject(java.lang.String expression, java.lang.String alias)
Creates a SelectObject using the given alias and expression, parsing the expression into an appropriate set of SQLFragments.
|
SelectObject |
AbstractSQLQueryBuilder.constructSelectObject(java.lang.String expression, java.lang.String alias) |
SQLQueryBuilder.SQLQueryObjectSet |
SQLQueryBuilder.constructSelectObjects(Column[] baseCols, FromObject[] usagesToUse)
Creates a set of SelectObjects for the query based on the columns passed in.
|
SQLQueryBuilder.SQLQueryObjectSet |
AbstractSQLQueryBuilder.constructSelectObjects(Column[] baseCols, FromObject[] usagesToUse) |
protected abstract boolean |
AbstractSQLQueryBuilder.containsAsterisk() |
static SQLQueryBuilder |
SQLQueryBuilderFactory.createBuilder(DBObjectProvider provider, Schema defaultSchema, java.lang.String sqlText)
Returns a builder for the given provider by building the given sql text into a query using the default schema.
|
protected FromObject |
AbstractSQLQueryBuilder.createFromObject(SchemaObject rel, java.util.List<java.lang.String> extraNames) |
FromObject |
SQLQueryBuilder.createJoinObject(FKConstraint fk, FromObject left, FromObject right)
Creates a FromObject that joins using a JoinCondition matching the given FK and joins the two from objects.
|
FromObject |
AbstractSQLQueryBuilder.createJoinObject(FKConstraint fk, FromObject left, FromObject right) |
protected FKUsage |
AbstractSQLQueryBuilder.doConstructFKUsage(FKConstraint fk, java.util.Map relsIDsToUse, java.util.List<FromObject> newFroms) |
protected FromObject |
AbstractSQLQueryBuilder.doConstructFromObject(SchemaObject relation, java.util.List<DBObjectID> baseRelIDs, java.util.List<java.lang.String> relNames, java.util.Map<DBObjectID,FromObject> newRels, java.util.List<Column> cols, java.util.List<FKConstraint> fks) |
protected FromObject |
AbstractSQLQueryBuilder.doConstructJoin(FKConstraint fk, java.util.Map<DBObjectID,FromObject> relsIDsToUse, java.util.List<FromObject> newFroms, FromObject left, FromObject right) |
protected SelectObject |
AbstractSQLQueryBuilder.doConstructSelectObject(Column col, java.util.Map<DBObjectID,FromObject> relsToUse, java.util.Map<DBObjectID,FromObject> newRels, java.util.List<java.lang.String> relNames, java.util.List<java.lang.String> colNames) |
FromObjectUsage |
AbstractSQLQueryBuilder.findColumnInFromExpression(java.lang.String colName, boolean external, SQLFragment exp, boolean allowDuplicates, FromObject from, SQLFragment creating)
Finds a Column of given name in the given FromObject's expression.
|
protected FromObjectUsage |
AbstractSQLQueryBuilder.findColumnInFromObjects(java.lang.String colName, boolean external, FromObject[] froms, boolean allowDuplicates, boolean enforceInAll, SQLFragment creating)
Finds a Column of given name amongst the given FromObjects.
|
FromObjectUsage |
AbstractSQLQueryBuilder.findColumnInFromObjects(java.lang.String colName, boolean external, SQLFragment creating, FromObject... extraFroms)
Finds a Column of given name amongst the RelationUsages in the query.
|
protected FromObjectUsage |
AbstractSQLQueryBuilder.findColumnInJoin(java.lang.String colName, boolean external, JoinObject join, boolean allowDuplicates, SQLFragment creating)
Finds a column in the child FromObjects of a given JoinObject.
|
FromObjectUsage |
AbstractSQLQueryBuilder.findColumnInRelation(java.lang.String colName, boolean external, Relation rel)
Finds a Column with the given name in a Relation and returns a FromObjectUsage that references that column.
|
FromObjectUsage |
AbstractSQLQueryBuilder.findColumnInRelation(java.lang.String colName, boolean external, RelationUsage relU)
Finds a Column with the given name in the Relation referred to by the given RelationUsage, and returns a FromObjectUsage that references that column.
|
ColumnUsage |
AbstractSQLQueryBuilder.findColumnInStarSubQuery(java.lang.String colName, boolean external, FromObject from)
The from object is of the form (SELECT * FROM <rel>) <alias>
|
SelectObjectUsage |
AbstractSQLQueryBuilder.findColumnInSubQuery(java.lang.String colName, boolean external, SQLQuery query) |
static java.util.Collection<java.lang.String[]> |
ParserUtils.getColumnNames(java.lang.String expression, ParserUtils.ExpressionType type)
Deprecated.
|
static java.util.Collection<java.lang.String[]> |
ParserUtils.getColumnNames(java.lang.String expression, SQLFragmentExpressionBuilder.ExpressionType type, DBObjectProvider prov, Relation rel)
Returns a Collection of names of the columns used in
expression . |
static SQLFragment |
SQLFragmentExpressionBuilder.getExpression(DBObjectProvider provider, Relation relation, SQLFragmentExpressionBuilder.ExpressionType type, java.lang.String expression, boolean ignorErrors)
Deprecated.
|
static SQLFragment |
SQLFragmentExpressionBuilder.getExpressionOrFail(DBObjectProvider provider, Relation relation, SQLFragmentExpressionBuilder.ExpressionType type, java.lang.String expression)
For the given relation in the given provider, creates a SQLFragment condition representing the condition (such as a where clause predicate or check constraint)
|
protected java.util.List<DBObjectID> |
AbstractSQLQueryBuilder.getIDs(DBObject[] objs) |
abstract java.util.List<AbstractSQLQueryBuilder.QueryColumnInfo> |
AbstractSQLQueryBuilder.getQueryColumnInfos()
Obtains information about the select list items for use in building view and materialized view columns without building the query unless absolutely necessary.
|
void |
SQLQueryBuilder.mergeRelationUsages(RelationUsage baseUsage, RelationUsage mergingUsage)
Merges two RelationUsages into one.
|
void |
AbstractSQLQueryBuilder.mergeRelationUsages(RelationUsage baseUsage, RelationUsage mergingUsage) |
SQLFragment |
SQLQueryBuilder.parseFromExpression(java.lang.String expression)
Parses an expression to see if it is a valid expression for a From object.
|
SQLFragment |
AbstractSQLQueryBuilder.parseFromExpression(java.lang.String expression) |
protected SQLFragment |
AbstractSQLQueryBuilder.parseFromExpression(java.lang.String expression, FromObject creating) |
SQLFragment |
SQLQueryBuilder.parseHavingExpression(java.lang.String expression)
Parses an expression to see if it is a valid expression for a Having object.
|
SQLFragment |
AbstractSQLQueryBuilder.parseHavingExpression(java.lang.String expression)
By default this calls parseWhereExpression().
|
OnJoinCondition |
SQLQueryBuilder.parseOnExpression(java.lang.String expression, JoinObject join)
More specific than parseFromExpression() this method is used to specifically parse the ON expression for a JOIN in a FROM clause.
|
SQLFragment |
SQLQueryBuilder.parseOrderByExpression(java.lang.String expression)
Parses an expression to see if it is a valid expression for a Order By object.
|
SQLFragment |
AbstractSQLQueryBuilder.parseOrderByExpression(java.lang.String expression) |
protected SQLFragment |
AbstractSQLQueryBuilder.parseOrderByExpression(java.lang.String expression, OrderByObject obo) |
static PlsqlRoot |
ParserUtils.parseQueryString(java.lang.String expression, int type)
Deprecated.
|
SQLFragment |
SQLQueryBuilder.parseSelectExpression(java.lang.String expression)
Parses an expression to see if it is a valid expression for a Select object.
|
SQLFragment |
AbstractSQLQueryBuilder.parseSelectExpression(java.lang.String expression) |
protected SQLFragment |
AbstractSQLQueryBuilder.parseSelectExpression(java.lang.String expression, SelectObject creating) |
SQLFragment |
SQLQueryBuilder.parseWhereExpression(java.lang.String expression)
Parses an expression to see if it is a valid expression for a Where object.
|
SQLFragment |
AbstractSQLQueryBuilder.parseWhereExpression(java.lang.String expression) |
SQLFragment |
AbstractSQLQueryBuilder.parseWhereExpression(java.lang.String expression, WhereObject creating) |
void |
SQLQueryBuilder.replaceFromObject(FromObject oldFrom, FromObject newFrom)
Replaces the existing from object with a new one.
|
void |
AbstractSQLQueryBuilder.replaceFromObject(FromObject oldFrom, FromObject newFrom) |
void |
SQLQueryBuilder.replaceSelectObject(SelectObject oldSelect, SelectObject newSelect)
Replaces the existing select object with a new one.
|
void |
AbstractSQLQueryBuilder.replaceSelectObject(SelectObject oldSelect, SelectObject newSelect) |
<T extends SQLQueryException> |
AbstractSQLQueryBuilder.throwException(T sqe)
Method that takes a SQLQueryException and rethrows it unless it is a SQLQueryClauseException and we are in the middle of a build.
|
void |
SQLQueryBuilder.validateQuery()
Validates a query object to check that its internal structure is correct.
|
void |
AbstractSQLQueryBuilder.validateQuery() |