org.datanucleus.store.rdbms.query
Class JDOQLQuery

java.lang.Object
  extended by org.datanucleus.store.query.Query
      extended by org.datanucleus.store.query.AbstractJavaQuery
          extended by org.datanucleus.store.query.AbstractJDOQLQuery
              extended by org.datanucleus.store.rdbms.query.JDOQLQuery
All Implemented Interfaces:
Serializable

public class JDOQLQuery
extends org.datanucleus.store.query.AbstractJDOQLQuery

RDBMS representation of a JDOQL query for use by DataNucleus. The query can be specified via method calls, or via a single-string form. This implementation uses the generic query compilation in "org.datanucleus.query". There are the following main ways of running a query here

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.query.Query
org.datanucleus.store.query.Query.SubqueryDefinition
 
Field Summary
protected  RDBMSQueryCompilation datastoreCompilation
          The compilation of the query for this datastore.
static String EXTENSION_RDBMS_FETCH_DIRECTION
           
static String EXTENSION_RDBMS_RESULTSET_CONCURRENCY
           
static String EXTENSION_RDBMS_RESULTSET_TYPE
           
 
Fields inherited from class org.datanucleus.store.query.AbstractJavaQuery
candidateCollection, candidateExtent, singleString
 
Fields inherited from class org.datanucleus.store.query.Query
BULK_DELETE, BULK_UPDATE, candidateClass, candidateClassName, clr, compilation, ec, explicitParameters, explicitVariables, EXTENSION_CHECK_UNUSED_PARAMETERS, EXTENSION_COMPILATION_CACHED, EXTENSION_EVALUATE_IN_MEMORY, EXTENSION_FLUSH_BEFORE_EXECUTION, EXTENSION_LOAD_RESULTS_AT_COMMIT, EXTENSION_MULTITHREAD, EXTENSION_RESULT_CACHE_TYPE, EXTENSION_RESULT_SIZE_METHOD, EXTENSION_RESULTS_CACHED, EXTENSION_USE_FETCH_PLAN, extensions, filter, from, fromInclNo, fromInclParam, grouping, having, ignoreCache, implicitParameters, imports, inputParameters, LOCALISER, ordering, OTHER, parameterNames, parsedImports, queryResults, range, result, resultClass, resultClassName, resultDistinct, SELECT, storeMgr, subclasses, subqueries, tasks, toExclNo, toExclParam, type, unique, unmodifiable, update
 
Constructor Summary
JDOQLQuery(org.datanucleus.store.StoreManager storeMgr, org.datanucleus.store.ExecutionContext ec)
          Constructs a new query instance that uses the given object manager.
JDOQLQuery(org.datanucleus.store.StoreManager storeMgr, org.datanucleus.store.ExecutionContext ec, JDOQLQuery q)
          Constructs a new query instance having the same criteria as the given query.
JDOQLQuery(org.datanucleus.store.StoreManager storeMgr, org.datanucleus.store.ExecutionContext ec, String query)
          Constructor for a JDOQL query where the query is specified using the "Single-String" format.
 
Method Summary
 void addExtension(String key, Object value)
          Add a vendor-specific extension this query.
protected  void assertSupportsCancel()
          Method that will throw an UnsupportedOperationException if the query implementation doesn't support cancelling queries.
protected  boolean cancelTaskObject(Object obj)
           
protected  void compileInternal(Map parameterValues)
          Method to compile the JDOQL query.
protected  void compileQueryDelete(Map parameterValues, org.datanucleus.metadata.AbstractClassMetaData candidateCmd)
          Method to compile the query for RDBMS for a bulk delete.
protected  void compileQueryUpdate(Map parameterValues, org.datanucleus.metadata.AbstractClassMetaData candidateCmd)
          Method to compile the query for RDBMS for a bulk update.
protected  void discardCompiled()
          Utility to remove any previous compilation of this Query.
protected  boolean evaluateInMemory()
          Convenience method to return whether the query should be evaluated in-memory.
 String getSQL()
          Convenience accessor for the SQL to invoke in the datastore for this query.
 Set<String> getSupportedExtensions()
          Method to return the names of the extensions supported by this query.
protected  boolean isCompiled()
          Method to return if the query is compiled.
protected  Object performExecute(Map parameters)
           
 boolean processesRangeInDatastoreQuery()
           
 void setExtensions(Map extensions)
          Set multiple extensions, or use null to clear extensions.
protected  boolean supportsTimeout()
          Convenience method for whether this query supports timeouts.
 
Methods inherited from class org.datanucleus.store.query.AbstractJDOQLQuery
compileSubqueries, getLanguage, getQueryCacheKey, getSingleStringQuery, setGrouping, setResult
 
Methods inherited from class org.datanucleus.store.query.AbstractJavaQuery
dereferenceFilter, getCandidateCollection, getCandidateExtent, performDeletePersistentAll, setCandidates, setCandidates, toString
 
Methods inherited from class org.datanucleus.store.query.Query
addSubquery, applyImplicitParameterValueToCompilation, applyImplicitParameterValueToSubqueries, assertIsModifiable, cancel, cancel, checkForMissingParameters, checkParameterTypesAgainstCompilation, checkUnusedParameters, close, closeAll, compile, declareExplicitParameters, declareExplicitVariables, declareImports, deepFindSymbolForParameterInCompilation, deletePersistentAll, deletePersistentAll, deletePersistentAll, deregisterTask, equals, execute, executeQuery, executeWithArray, executeWithMap, getBooleanExtensionProperty, getCandidateClass, getCandidateClassName, getCompilation, getDatastoreReadTimeoutMillis, getDatastoreWriteTimeoutMillis, getExecutionContext, getExplicitParameters, getExplicitVariables, getExtension, getExtensions, getFetchPlan, getFilter, getFrom, getGrouping, getHaving, getIgnoreCache, getImplicitParameters, getImports, getInputParameters, getOrdering, getParameterMapForValues, getParsedImports, getQueryManager, getRange, getRangeFromIncl, getRangeFromInclParam, getRangeToExcl, getRangeToExclParam, getResult, getResultClass, getResultClassName, getResultDistinct, getSerializeRead, getStoreManager, getStringExtensionProperty, getSubqueryForVariable, getType, getUpdate, hashCode, hasSubqueryForVariable, isSubclasses, isUnique, isUnmodifiable, prepareDatastore, registerTask, resolveClassDeclaration, setCacheResults, setCandidateClass, setCandidateClassName, setCompilation, setDatastoreReadTimeoutMillis, setDatastoreWriteTimeoutMillis, setFetchPlan, setFilter, setFrom, setHaving, setIgnoreCache, setImplicitParameter, setImplicitParameter, setOrdering, setRange, setRange, setResultClass, setResultClassName, setResultDistinct, setResultMetaData, setSerializeRead, setSubclasses, setType, setUnique, setUnmodifiable, setUpdate, shouldReturnSingleRow, useCaching, useFetchPlan, useResultsCaching
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

datastoreCompilation

protected transient RDBMSQueryCompilation datastoreCompilation
The compilation of the query for this datastore. Not applicable if totally in-memory.


EXTENSION_RDBMS_RESULTSET_TYPE

public static final String EXTENSION_RDBMS_RESULTSET_TYPE
See Also:
Constant Field Values

EXTENSION_RDBMS_RESULTSET_CONCURRENCY

public static final String EXTENSION_RDBMS_RESULTSET_CONCURRENCY
See Also:
Constant Field Values

EXTENSION_RDBMS_FETCH_DIRECTION

public static final String EXTENSION_RDBMS_FETCH_DIRECTION
See Also:
Constant Field Values
Constructor Detail

JDOQLQuery

public JDOQLQuery(org.datanucleus.store.StoreManager storeMgr,
                  org.datanucleus.store.ExecutionContext ec)
Constructs a new query instance that uses the given object manager.

Parameters:
storeMgr - StoreManager for this query
ec - execution context

JDOQLQuery

public JDOQLQuery(org.datanucleus.store.StoreManager storeMgr,
                  org.datanucleus.store.ExecutionContext ec,
                  JDOQLQuery q)
Constructs a new query instance having the same criteria as the given query.

Parameters:
storeMgr - StoreManager for this query
ec - execution context
q - The query from which to copy criteria.

JDOQLQuery

public JDOQLQuery(org.datanucleus.store.StoreManager storeMgr,
                  org.datanucleus.store.ExecutionContext ec,
                  String query)
Constructor for a JDOQL query where the query is specified using the "Single-String" format.

Parameters:
storeMgr - StoreManager for this query
ec - execution context
query - The single-string query form
Method Detail

discardCompiled

protected void discardCompiled()
Utility to remove any previous compilation of this Query.

Overrides:
discardCompiled in class org.datanucleus.store.query.AbstractJavaQuery

isCompiled

protected boolean isCompiled()
Method to return if the query is compiled.

Overrides:
isCompiled in class org.datanucleus.store.query.Query
Returns:
Whether it is compiled

evaluateInMemory

protected boolean evaluateInMemory()
Convenience method to return whether the query should be evaluated in-memory.

Overrides:
evaluateInMemory in class org.datanucleus.store.query.AbstractJavaQuery
Returns:
Use in-memory evaluation?

compileInternal

protected void compileInternal(Map parameterValues)
Method to compile the JDOQL query. Uses the superclass to compile the generic query populating the "compilation", and then generates the datastore-specific "datastoreCompilation".

Overrides:
compileInternal in class org.datanucleus.store.query.AbstractJDOQLQuery
Parameters:
parameterValues - Map of param values keyed by param name (if available at compile time)

getSQL

public String getSQL()
Convenience accessor for the SQL to invoke in the datastore for this query.

Returns:
The SQL.

performExecute

protected Object performExecute(Map parameters)
Specified by:
performExecute in class org.datanucleus.store.query.Query

assertSupportsCancel

protected void assertSupportsCancel()
Method that will throw an UnsupportedOperationException if the query implementation doesn't support cancelling queries.

Overrides:
assertSupportsCancel in class org.datanucleus.store.query.Query

cancelTaskObject

protected boolean cancelTaskObject(Object obj)
Overrides:
cancelTaskObject in class org.datanucleus.store.query.Query

supportsTimeout

protected boolean supportsTimeout()
Convenience method for whether this query supports timeouts.

Overrides:
supportsTimeout in class org.datanucleus.store.query.Query
Returns:
Whether timeouts are supported.

compileQueryUpdate

protected void compileQueryUpdate(Map parameterValues,
                                  org.datanucleus.metadata.AbstractClassMetaData candidateCmd)
Method to compile the query for RDBMS for a bulk update.

Parameters:
parameterValues - The parameter values (if any)
candidateCmd - Meta-data for the candidate class

compileQueryDelete

protected void compileQueryDelete(Map parameterValues,
                                  org.datanucleus.metadata.AbstractClassMetaData candidateCmd)
Method to compile the query for RDBMS for a bulk delete.

Parameters:
parameterValues - The parameter values (if any)
candidateCmd - Meta-data for the candidate class

getSupportedExtensions

public Set<String> getSupportedExtensions()
Method to return the names of the extensions supported by this query. To be overridden by subclasses where they support additional extensions.

Overrides:
getSupportedExtensions in class org.datanucleus.store.query.Query
Returns:
The supported extension names

processesRangeInDatastoreQuery

public boolean processesRangeInDatastoreQuery()
Overrides:
processesRangeInDatastoreQuery in class org.datanucleus.store.query.Query

addExtension

public void addExtension(String key,
                         Object value)
Add a vendor-specific extension this query. Intercepts any setting of in-memory evaluation, so we can throw away any datastore compilation.

Overrides:
addExtension in class org.datanucleus.store.query.Query
Parameters:
key - the extension key
value - the extension value

setExtensions

public void setExtensions(Map extensions)
Set multiple extensions, or use null to clear extensions. Intercepts any settong of in-memory evaluation, so we can throw away any datastore compilation.

Overrides:
setExtensions in class org.datanucleus.store.query.Query
Parameters:
extensions -


Copyright © 2012. All Rights Reserved.