Class QueryCompilation

java.lang.Object
org.datanucleus.store.query.compiler.QueryCompilation
All Implemented Interfaces:
Serializable

public class QueryCompilation extends Object implements 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 Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • queryLanguage

      protected String queryLanguage
      Query language that this is a compilation for.
    • candidateClass

      protected Class candidateClass
      Primary candidate class.
    • candidateAlias

      protected String candidateAlias
      Alias for the (primary) candidate. Defaults to "this".
    • returnsSingleRow

      protected boolean returnsSingleRow
      Whether the query will return a single row.
    • symtbl

      protected SymbolTable symtbl
      Compiled Symbol Table.
    • resultDistinct

      protected boolean resultDistinct
      Whether the result is distinct.
    • exprResult

      protected Expression[] exprResult
      Compiled result expression.
    • exprFrom

      protected Expression[] exprFrom
      Compiled from expression.
    • exprUpdate

      protected Expression[] exprUpdate
      Compiled update expression.
    • exprFilter

      protected Expression exprFilter
      Compiled filter expression
    • exprGrouping

      protected Expression[] exprGrouping
      Compiled grouping expression.
    • exprHaving

      protected Expression exprHaving
      Compiled having expression.
    • exprOrdering

      protected Expression[] exprOrdering
      Compiled ordering expression.
    • subqueryCompilations

      protected Map<String,QueryCompilation> subqueryCompilations
      Compilations of any subqueries, keyed by the subquery variable name.
  • Constructor Details

  • Method Details

    • setQueryLanguage

      public void setQueryLanguage(String lang)
    • getQueryLanguage

      public String getQueryLanguage()
    • setResultDistinct

      public void setResultDistinct()
    • getResultDistinct

      public boolean getResultDistinct()
    • setReturnsSingleRow

      public void setReturnsSingleRow()
    • addSubqueryCompilation

      public void addSubqueryCompilation(String alias, QueryCompilation compilation)
      Method to add the compilation for a subquery of this query.
      Parameters:
      alias - Alias for the subquery (variable name)
      compilation - The compilation
    • getCompilationForSubquery

      public QueryCompilation getCompilationForSubquery(String alias)
      Accessor for the compilation for a subquery with the specified alias.
      Parameters:
      alias - Alias of subquery
      Returns:
      The compilation
    • getSubqueryAliases

      public String[] 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

      public Class[] 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

      public Class getCandidateClass()
      Accessor for the candidate class.
      Returns:
      Candidate class
    • getCandidateAlias

      public String getCandidateAlias()
      Accessor for the candidate alias.
      Returns:
      Candidate alias
    • getSymbolTable

      public SymbolTable getSymbolTable()
      Accessor for the symbol table for the query.
      Returns:
      Symbol table, for parameter, variable lookup.
    • getExprResult

      public Expression[] getExprResult()
      Accessor for any result expression(s).
      Returns:
      The results
    • getExprFrom

      public Expression[] getExprFrom()
      Accessor for any from expression(s).
      Returns:
      The from clauses
    • getExprUpdate

      public Expression[] getExprUpdate()
      Accessor for any update expression(s).
      Returns:
      The updates
    • getExprFilter

      public Expression getExprFilter()
      Accessor for the filter expression.
      Returns:
      The filter
    • setExprFilter

      public void setExprFilter(Expression filter)
    • getExprGrouping

      public Expression[] getExprGrouping()
      Accessor for any grouping expression(s).
      Returns:
      The grouping
    • getExprHaving

      public Expression getExprHaving()
      Accessor for any having expression.
      Returns:
      The having clause
    • setExprHaving

      public void setExprHaving(Expression having)
    • getExprOrdering

      public Expression[] getExprOrdering()
      Accessor for any ordering expression(s).
      Returns:
      The ordering
    • getParameterExpressionForPosition

      public ParameterExpression getParameterExpressionForPosition(int pos)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • debugString

      public String debugString(String indent)