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 StringAlias for the (primary) candidate.protected ClassPrimary candidate class.protected ExpressionCompiled filter expressionprotected Expression[]Compiled from expression.protected Expression[]Compiled grouping expression.protected ExpressionCompiled having expression.protected Expression[]Compiled ordering expression.protected Expression[]Compiled result expression.protected Expression[]Compiled update expression.protected StringQuery language that this is a compilation for.protected booleanWhether the result is distinct.protected booleanWhether the query will return a single row.private static final longprotected Map<String, QueryCompilation> Compilations of any subqueries, keyed by the subquery variable name.protected SymbolTableCompiled 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 TypeMethodDescriptionvoidaddSubqueryCompilation(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) booleanClass[]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.booleanAccessor for whether this query will return a single row.voidsetExprFilter(Expression filter) voidsetExprHaving(Expression having) voidsetQueryLanguage(String lang) voidvoidtoString()
-
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
-
getCandidateAlias
-
getSymbolTable
Accessor for the symbol table for the query.- Returns:
- Symbol table, for parameter, variable lookup.
-
getExprResult
-
getExprFrom
-
getExprUpdate
-
getExprFilter
-
setExprFilter
-
getExprGrouping
Accessor for any grouping expression(s).- Returns:
- The grouping
-
getExprHaving
-
setExprHaving
-
getExprOrdering
Accessor for any ordering expression(s).- Returns:
- The ordering
-
getParameterExpressionForPosition
-
toString
-
debugString
-