Class QueryCompilation
java.lang.Object
org.datanucleus.store.query.compiler.QueryCompilation
- All Implemented Interfaces:
Serializable
Representation of the components of a compiled java "string-based" query.
Assumes that the query has the following forms
SELECT {result} FROM {from} WHERE {filter} GROUP BY {grouping} HAVING {having} ORDER BY {order} UPDATE {from} SET {update} WHERE {filter} DELETE FROM {from} WHERE {filter}
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
Alias for the (primary) candidate.protected Class
Primary candidate class.protected Expression
Compiled filter expressionprotected Expression[]
Compiled from expression.protected Expression[]
Compiled grouping expression.protected Expression
Compiled having expression.protected Expression[]
Compiled ordering expression.protected Expression[]
Compiled result expression.protected Expression[]
Compiled update expression.protected String
Query language that this is a compilation for.protected boolean
Whether the result is distinct.protected boolean
Whether the query will return a single row.private static final long
protected Map
<String, QueryCompilation> Compilations of any subqueries, keyed by the subquery variable name.protected SymbolTable
Compiled Symbol Table. -
Constructor Summary
ConstructorsConstructorDescriptionQueryCompilation
(Class candidateCls, String candidateAlias, SymbolTable symtbl, Expression[] results, Expression[] froms, Expression filter, Expression[] groupings, Expression having, Expression[] orderings, Expression[] updates) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSubqueryCompilation
(String alias, QueryCompilation compilation) Method to add the compilation for a subquery of this query.debugString
(String indent) Accessor for the candidate alias.Accessor for the candidate class.getCompilationForSubquery
(String alias) Accessor for the compilation for a subquery with the specified alias.Accessor for the filter expression.Accessor for any from expression(s).Accessor for any grouping expression(s).Accessor for any having expression.Accessor for any ordering expression(s).Accessor for any result expression(s).Accessor for any update expression(s).getParameterExpressionForPosition
(int pos) boolean
Class[]
Accessor for the types of the result row components.String[]
Accessor for the aliases for any subqueries in this compilation.Accessor for the symbol table for the query.boolean
Accessor for whether this query will return a single row.void
setExprFilter
(Expression filter) void
setExprHaving
(Expression having) void
setQueryLanguage
(String lang) void
void
toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
queryLanguage
Query language that this is a compilation for. -
candidateClass
Primary candidate class. -
candidateAlias
Alias for the (primary) candidate. Defaults to "this". -
returnsSingleRow
protected boolean returnsSingleRowWhether the query will return a single row. -
symtbl
Compiled Symbol Table. -
resultDistinct
protected boolean resultDistinctWhether the result is distinct. -
exprResult
Compiled result expression. -
exprFrom
Compiled from expression. -
exprUpdate
Compiled update expression. -
exprFilter
Compiled filter expression -
exprGrouping
Compiled grouping expression. -
exprHaving
Compiled having expression. -
exprOrdering
Compiled ordering expression. -
subqueryCompilations
Compilations of any subqueries, keyed by the subquery variable name.
-
-
Constructor Details
-
QueryCompilation
public QueryCompilation(Class candidateCls, String candidateAlias, SymbolTable symtbl, Expression[] results, Expression[] froms, Expression filter, Expression[] groupings, Expression having, Expression[] orderings, Expression[] updates)
-
-
Method Details
-
setQueryLanguage
-
getQueryLanguage
-
setResultDistinct
public void setResultDistinct() -
getResultDistinct
public boolean getResultDistinct() -
setReturnsSingleRow
public void setReturnsSingleRow() -
addSubqueryCompilation
Method to add the compilation for a subquery of this query.- Parameters:
alias
- Alias for the subquery (variable name)compilation
- The compilation
-
getCompilationForSubquery
Accessor for the compilation for a subquery with the specified alias.- Parameters:
alias
- Alias of subquery- Returns:
- The compilation
-
getSubqueryAliases
Accessor for the aliases for any subqueries in this compilation.- Returns:
- The subquery aliases (if any)
-
returnsSingleRow
public boolean returnsSingleRow()Accessor for whether this query will return a single row. This is true if all result selects are aggregates, or the user has set "unique" on the query.- Returns:
- Whether this query will return a single row
-
getResultTypes
Accessor for the types of the result row components. If no result is defined then will be an array of size 1 with element type "candidate".- Returns:
- The result type(s)
-
getCandidateClass
Accessor for the candidate class.- Returns:
- Candidate class
-
getCandidateAlias
Accessor for the candidate alias.- Returns:
- Candidate alias
-
getSymbolTable
Accessor for the symbol table for the query.- Returns:
- Symbol table, for parameter, variable lookup.
-
getExprResult
Accessor for any result expression(s).- Returns:
- The results
-
getExprFrom
Accessor for any from expression(s).- Returns:
- The from clauses
-
getExprUpdate
Accessor for any update expression(s).- Returns:
- The updates
-
getExprFilter
Accessor for the filter expression.- Returns:
- The filter
-
setExprFilter
-
getExprGrouping
Accessor for any grouping expression(s).- Returns:
- The grouping
-
getExprHaving
Accessor for any having expression.- Returns:
- The having clause
-
setExprHaving
-
getExprOrdering
Accessor for any ordering expression(s).- Returns:
- The ordering
-
getParameterExpressionForPosition
-
toString
-
debugString
-