public final class SQLQuery
extends org.datanucleus.store.query.Query
| Modifier and Type | Field and Description |
|---|---|
protected String |
compiledSQL
The actual SQL issued at execution time.
|
protected String |
inputSQL
The statement that the user specified to the Query.
|
protected boolean |
isCompiled
State variable for the compilation state
|
protected org.datanucleus.metadata.QueryResultMetaData |
resultMetaData
MetaData defining the results of the query.
|
protected StatementMappingIndex[] |
stmtMappings
Mappings for the result of the query.
|
candidateClass, candidateClassName, clr, compilation, ec, explicitParameters, explicitVariables, EXTENSION_CHECK_UNUSED_PARAMETERS, EXTENSION_CLOSE_RESULTS_AT_EC_CLOSE, EXTENSION_COMPILATION_CACHED, EXTENSION_EVALUATE_IN_MEMORY, EXTENSION_EXCLUDE_SUBCLASSES, EXTENSION_FLUSH_BEFORE_EXECUTION, EXTENSION_JDOQL_STRICT, EXTENSION_JPQL_STRICT, EXTENSION_LOAD_RESULTS_AT_COMMIT, EXTENSION_MULTITHREAD, EXTENSION_RESULT_CACHE_TYPE, EXTENSION_RESULT_SIZE_METHOD, EXTENSION_RESULTS_CACHED, EXTENSION_SQL_SYNTAX_CHECKS, EXTENSION_USE_FETCH_PLAN, extensions, filter, from, fromInclNo, fromInclParam, grouping, having, ignoreCache, implicitParameters, imports, inputParameters, insertFields, insertSelectQuery, LANGUAGE_JDOQL, LANGUAGE_JPQL, LANGUAGE_SQL, ordering, parameterNames, parsedImports, queryResults, range, result, resultClass, resultClassName, resultDistinct, storeMgr, subclasses, subqueries, tasks, toExclNo, toExclParam, type, unique, unmodifiable, update| Constructor and Description |
|---|
SQLQuery(org.datanucleus.store.StoreManager storeMgr,
org.datanucleus.ExecutionContext ec)
Constructs a new query instance.
|
SQLQuery(org.datanucleus.store.StoreManager storeMgr,
org.datanucleus.ExecutionContext ec,
SQLQuery query)
Constructor for a new query using the existing query as start point.
|
SQLQuery(org.datanucleus.store.StoreManager storeMgr,
org.datanucleus.ExecutionContext ec,
String queryString)
Constructs a new query instance for the provided SQL query.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertSupportsCancel()
Method that will throw an
UnsupportedOperationException if the query implementation doesn't
support cancelling queries. |
static boolean |
columnNamesAreTheSame(DatastoreAdapter dba,
String name1,
String name2)
Convenience method to compare two column names.
|
void |
compileInternal(Map parameterValues)
Verify the elements of the query and provide a hint to the query to prepare and optimize an execution plan.
|
void |
declareExplicitParameters(String parameters)
Declare the explicit parameters to be used in the query.
|
void |
declareExplicitVariables(String variables)
Declare the unbound variables to be used in the query.
|
void |
declareImports(String imports)
Set the import statements to be used to identify the fully qualified name of variables or parameters.
|
protected void |
discardCompiled()
Utility to remove any previous compilation of this Query.
|
boolean |
equals(Object obj) |
Object |
executeWithArray(Object[] parameters)
Execute the query and return the filtered List.
|
Object |
executeWithMap(Map executeParameters)
Execute the query using the input Map of parameters.
|
String |
getLanguage() |
protected ResultObjectFactory |
getResultObjectFactoryForCandidateClass(ResultSet rs)
Method to generate a ResultObjectFactory for converting rows of the provided ResultSet into instances of the candidate class.
|
int |
hashCode() |
protected boolean |
isCompiled()
Method to return if the query is compiled.
|
protected long |
performDeletePersistentAll(Map parameters)
Execute the query to delete persistent objects.
|
protected Object |
performExecute(Map parameters)
Execute the query and return the result.
|
protected Map |
prepareForExecution(Map executeParameters)
Method to process the input parameters preparing the statement and parameters for execution.
|
boolean |
processesRangeInDatastoreQuery() |
void |
setCandidates(Collection pcs)
Set the candidate Collection to query.
|
void |
setCandidates(org.datanucleus.store.Extent pcs)
Set the candidate Extent to query.
|
void |
setFilter(String filter)
Set the filter for the query.
|
void |
setGrouping(String grouping)
Set the grouping specification for the result Collection.
|
void |
setOrdering(String ordering)
Set the ordering specification for the result Collection.
|
void |
setRange(int fromIncl,
int toExcl)
Set the range of the results.
|
void |
setResult(String result)
Set the result for the results.
|
void |
setResultClass(Class result_cls)
Set the result class for the results.
|
void |
setResultMetaData(org.datanucleus.metadata.QueryResultMetaData qrmd)
Method to set the MetaData defining the result.
|
void |
setSubclasses(boolean subclasses)
Method to set whether to use subclasses.
|
protected boolean |
shouldReturnSingleRow()
Convenience method to return whether the query should return a single row.
|
protected boolean |
supportsTimeout() |
addExtension, addSubquery, applyImplicitParameterValueToCompilation, applyImplicitParameterValueToSubqueries, assertIsModifiable, assertIsOpen, cancel, cancel, cancelTaskObject, checkForMissingParameters, checkParameterTypesAgainstCompilation, checkUnusedParameters, close, closeAll, compile, deepFindSymbolForParameterInCompilation, deletePersistentAll, deletePersistentAll, deletePersistentAll, deregisterTask, execute, executeQuery, executionContextClosing, getBooleanExtensionProperty, getCandidateClass, getCandidateClassMetaData, getCandidateClassName, getCompilation, getDatastoreReadTimeoutMillis, getDatastoreWriteTimeoutMillis, getExecutionContext, getExplicitParametersDeclaration, getExplicitVariablesDeclaration, getExtension, getExtensions, getFetchPlan, getFilter, getFrom, getGrouping, getHaving, getIgnoreCache, getImplicitParameters, getImportsDeclaration, getInputParameters, getInsertFields, getInsertSelectQuery, getNativeQuery, getOrdering, getParameterMapForValues, getParsedImports, getQueryManager, getRange, getRangeFromIncl, getRangeFromInclParam, getRangeToExcl, getRangeToExclParam, getResult, getResultClass, getResultClassName, getResultDistinct, getSerializeRead, getStoreManager, getStringExtensionProperty, getSubqueryForVariable, getSupportedExtensions, getType, getUpdate, hasSubqueryForVariable, isSubclasses, isUnique, isUnmodifiable, prepareDatastore, registerTask, resolveClassDeclaration, setCacheResults, setCandidateClass, setCandidateClassName, setCompilation, setDatastoreReadTimeoutMillis, setDatastoreWriteTimeoutMillis, setExtensions, setFetchPlan, setFrom, setHaving, setIgnoreCache, setImplicitParameter, setImplicitParameter, setInsertFields, setInsertSelectQuery, setRange, setRange, setResultClassName, setResultDistinct, setSerializeRead, setType, setUnique, setUnmodifiable, setUpdate, useCaching, useFetchPlan, useResultsCachingprotected final transient String inputSQL
protected transient String compiledSQL
protected org.datanucleus.metadata.QueryResultMetaData resultMetaData
protected transient boolean isCompiled
protected transient StatementMappingIndex[] stmtMappings
public SQLQuery(org.datanucleus.store.StoreManager storeMgr,
org.datanucleus.ExecutionContext ec,
SQLQuery query)
storeMgr - StoreManager for this queryec - execution contextquery - The existing querypublic SQLQuery(org.datanucleus.store.StoreManager storeMgr,
org.datanucleus.ExecutionContext ec)
storeMgr - StoreManager for this queryec - execution contextpublic SQLQuery(org.datanucleus.store.StoreManager storeMgr,
org.datanucleus.ExecutionContext ec,
String queryString)
storeMgr - StoreManager for this queryec - execution contextqueryString - The SQL query stringpublic String getLanguage()
getLanguage in class org.datanucleus.store.query.Querypublic void setCandidates(org.datanucleus.store.Extent pcs)
setCandidates in class org.datanucleus.store.query.Querypcs - the Candidate Extent.org.datanucleus.exceptions.NucleusUserException - Always thrown since method not applicablepublic void setCandidates(Collection pcs)
setCandidates in class org.datanucleus.store.query.Querypcs - the Candidate collection.org.datanucleus.exceptions.NucleusUserException - Always thrown since method not applicablepublic void setResult(String result)
setResult in class org.datanucleus.store.query.Queryresult - The result parameter consists of the optional keyword
distinct followed by a commaseparated list of named result expressions or
a result class specification.org.datanucleus.exceptions.NucleusUserException - Always thrown.public void setResultMetaData(org.datanucleus.metadata.QueryResultMetaData qrmd)
setResultMetaData in class org.datanucleus.store.query.Queryqrmd - Query Result MetaDatapublic void setResultClass(Class result_cls)
setResultClass in class org.datanucleus.store.query.Queryresult_cls - The result classpublic void setRange(int fromIncl,
int toExcl)
fromIncl - From element no (inclusive) to returntoExcl - To element no (exclusive) to returnorg.datanucleus.exceptions.NucleusUserException - Always thrown.public void setSubclasses(boolean subclasses)
setSubclasses in class org.datanucleus.store.query.Querysubclasses - Whether to use subclassesorg.datanucleus.exceptions.NucleusUserException - Always thrown.public void setFilter(String filter)
setFilter in class org.datanucleus.store.query.Queryfilter - the query filter.org.datanucleus.exceptions.NucleusUserException - Always thrown since method not applicablepublic void declareExplicitVariables(String variables)
declareExplicitVariables in class org.datanucleus.store.query.Queryvariables - the variables separated by semicolons.org.datanucleus.exceptions.NucleusUserException - Always thrown since method not applicablepublic void declareExplicitParameters(String parameters)
declareExplicitParameters in class org.datanucleus.store.query.Queryparameters - the parameters separated by semicolons.org.datanucleus.exceptions.NucleusUserException - Always thrown.public void declareImports(String imports)
declareImports in class org.datanucleus.store.query.Queryimports - import statements separated by semicolons.org.datanucleus.exceptions.NucleusUserException - Always thrown.public void setGrouping(String grouping)
setGrouping in class org.datanucleus.store.query.Querygrouping - the grouping specification.org.datanucleus.exceptions.NucleusUserException - Always thrown.public void setOrdering(String ordering)
setOrdering in class org.datanucleus.store.query.Queryordering - the ordering specification.org.datanucleus.exceptions.NucleusUserException - Always thrown.protected long performDeletePersistentAll(Map parameters)
performDeletePersistentAll in class org.datanucleus.store.query.Queryparameters - the Map containing all of the parameters.protected boolean shouldReturnSingleRow()
shouldReturnSingleRow in class org.datanucleus.store.query.Querypublic boolean processesRangeInDatastoreQuery()
processesRangeInDatastoreQuery in class org.datanucleus.store.query.Querypublic boolean equals(Object obj)
equals in class org.datanucleus.store.query.Querypublic int hashCode()
hashCode in class org.datanucleus.store.query.Queryprotected void discardCompiled()
discardCompiled in class org.datanucleus.store.query.Queryprotected boolean isCompiled()
isCompiled in class org.datanucleus.store.query.Querypublic void compileInternal(Map parameterValues)
compileInternal in class org.datanucleus.store.query.Queryprotected Object performExecute(Map parameters)
performExecute in class org.datanucleus.store.query.Queryparameters - the Map containing all of the parameters (positional parameters) (not null)public Object executeWithArray(Object[] parameters)
executeWithArray in class org.datanucleus.store.query.Queryparameters - the Object array with all of the parameters.public Object executeWithMap(Map executeParameters)
executeWithMap in class org.datanucleus.store.query.QueryexecuteParameters - the Map of the parameters passed in to execute().protected Map prepareForExecution(Map executeParameters)
executeParameters - The input parameters mapprotected void assertSupportsCancel()
UnsupportedOperationException if the query implementation doesn't
support cancelling queries.assertSupportsCancel in class org.datanucleus.store.query.Queryprotected boolean supportsTimeout()
supportsTimeout in class org.datanucleus.store.query.Queryprotected ResultObjectFactory getResultObjectFactoryForCandidateClass(ResultSet rs) throws SQLException
rs - The ResultSetSQLException - Thrown if an error occurs processing the ResultSetpublic static boolean columnNamesAreTheSame(DatastoreAdapter dba, String name1, String name2)
dba - Datastore adaptername1 - The first name (from the datastore)name2 - The second name (from the user SQL statement)Copyright © 2019. All rights reserved.