Interface QueryGenerator
- All Known Implementing Classes:
QueryToSQLMapper
public interface QueryGenerator
Interface for a generator of query statements.
-
Method Summary
Modifier and TypeMethodDescriptionvoidbindParameter(String paramName, Class type) Method to bind the specified parameter to the defined type.voidbindVariable(String varName, org.datanucleus.metadata.AbstractClassMetaData cmd, SQLTable sqlTbl, JavaTypeMapping mapping) Method to bind the specified variable to the table and mapping.bindVariable(UnboundExpression expr, Class type) Method to bind the specified unbound variable (as cross join).org.datanucleus.ClassLoaderResolverAccessor for the ClassLoader resolver to use when looking up classes.org.datanucleus.store.query.compiler.CompilationComponentAccessor for the current query component being compiled.org.datanucleus.ExecutionContextAccessor for the ExecutionContext for this query.getProperty(String name) Accessor for a property affecting the query compilation.Accessor for the query language that this query pertains to.getTypeOfVariable(String varName) Accessor for the type of a variable if already known (declared?).Accessor for the value of the specified query extension (or null if not defined).booleanAccessor for whether the query has explicit joins.booleanhasExtension(String key) Accessor for whether the query being generated has the specified extension.booleanresolveClass(String className) Convenience method to resolve a class name.voiduseParameterExpressionAsLiteral(SQLLiteral paramLiteral) Method to instruct the generator to convert the provided parameter expression to just be a literal using the value of the parameter (hence the statement cannot be precompilable since the value needs to be known).
-
Method Details
-
getQueryLanguage
String getQueryLanguage()Accessor for the query language that this query pertains to. Can be used to decide how to handle the input.- Returns:
- The query language
-
getClassLoaderResolver
org.datanucleus.ClassLoaderResolver getClassLoaderResolver()Accessor for the ClassLoader resolver to use when looking up classes.- Returns:
- The classloader resolver
-
getExecutionContext
org.datanucleus.ExecutionContext getExecutionContext()Accessor for the ExecutionContext for this query.- Returns:
- ExecutionContext
-
getCompilationComponent
org.datanucleus.store.query.compiler.CompilationComponent getCompilationComponent()Accessor for the current query component being compiled.- Returns:
- Component being compiled (if any)
-
getProperty
-
useParameterExpressionAsLiteral
Method to instruct the generator to convert the provided parameter expression to just be a literal using the value of the parameter (hence the statement cannot be precompilable since the value needs to be known).- Parameters:
paramLiteral- The parameter expression
-
getTypeOfVariable
-
bindVariable
void bindVariable(String varName, org.datanucleus.metadata.AbstractClassMetaData cmd, SQLTable sqlTbl, JavaTypeMapping mapping) Method to bind the specified variable to the table and mapping.- Parameters:
varName- Variable namecmd- Metadata for this variable typesqlTbl- Table for this variablemapping- The mapping of this variable in the table
-
bindVariable
Method to bind the specified unbound variable (as cross join).- Parameters:
expr- Unbound expressiontype- The type to bind as- Returns:
- The bound expression to use instead
-
hasExplicitJoins
boolean hasExplicitJoins()Accessor for whether the query has explicit joins. A JPQL query has explicit joins, whereas a JDOQL query has variables and hence implicit joins. If not then has implicit joins, meaning that they could potentially be rebound later if prematurely bound in a particular way.- Returns:
- Whether the query has explicit joins
-
processingOnClause
boolean processingOnClause() -
bindParameter
Method to bind the specified parameter to the defined type. If the parameter is already bound (declared in the query perhaps, or bound via an earlier usage) then does nothing.- Parameters:
paramName- Name of the parametertype- The type (or subclass)
-
resolveClass
-
hasExtension
Accessor for whether the query being generated has the specified extension.- Parameters:
key- Extension name- Returns:
- Whether it is present
-
getValueForExtension
-