org.datanucleus.store.db4o.query
Class SQLQuery

java.lang.Object
  extended by org.datanucleus.store.query.Query
      extended by org.datanucleus.store.query.AbstractSQLQuery
          extended by org.datanucleus.store.db4o.query.SQLQuery
All Implemented Interfaces:
java.io.Serializable

public class SQLQuery
extends org.datanucleus.store.query.AbstractSQLQuery

SQL query implementation for db4o datastores. Builds a DataNucleus interface on top of the db4o-sql plugin written by Travis Reeder. See http://code.google.com/p/db4o-sql/

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  boolean isCompiled
          State variable for the compilation state
protected static org.datanucleus.util.Localiser LOCALISER_DB4O
          Localiser for messages.
 
Fields inherited from class org.datanucleus.store.query.AbstractSQLQuery
compiledSQL, inputSQL, resultMetaData
 
Fields inherited from class org.datanucleus.store.query.Query
BULK_DELETE, BULK_UPDATE, candidateClass, candidateClassName, compilation, explicitParameters, explicitVariables, extensions, filter, from, fromInclNo, fromInclParam, grouping, having, ignoreCache, implicitParameters, imports, LOCALISER, om, ordering, OTHER, parameterNames, parsedImports, queryResults, range, result, resultClass, resultClassName, resultDistinct, SELECT, subclasses, subqueries, tasks, toExclNo, toExclParam, type, unique, unmodifiable, update
 
Constructor Summary
SQLQuery(org.datanucleus.ObjectManager om)
          Constructs a new query instance having the same criteria as the given query.
SQLQuery(org.datanucleus.ObjectManager om, SQLQuery query)
          Constructor for a new query using the existing query.
SQLQuery(org.datanucleus.ObjectManager om, java.lang.String sqlText)
          Constructs a new query instance having the same criteria as the given query.
 
Method Summary
 void compileInternal(boolean forExecute, java.util.Map parameterValues)
          Verify the elements of the query and provide a hint to the query to prepare and optimize an execution plan.
protected  void discardCompiled()
          Utility to remove any previous compilation of this Query.
 boolean equals(java.lang.Object obj)
          Equality operator.
protected  java.lang.String generateQueryStatement()
          Method to perform any necessary pre-processing on the users query statement before we execute it.
protected  boolean isCompiled()
          Method to return if the query is compiled.
protected  java.lang.Object performExecute(java.util.Map parameters)
          Execute the query and return the result.
 
Methods inherited from class org.datanucleus.store.query.AbstractSQLQuery
declareExplicitParameters, declareExplicitVariables, declareImports, executeWithArray, executeWithMap, getInputSQL, getLanguage, performDeletePersistentAll, prepareForExecution, setCandidates, setCandidates, setFilter, setGrouping, setOrdering, setRange, setResult, setResultClass, setResultMetaData, setSubclasses, shouldReturnSingleRow
 
Methods inherited from class org.datanucleus.store.query.Query
addExtension, addSubquery, applyImplicitParameterValueToCompilation, applyRangeChecks, assertIsModifiable, assertSupportsCancel, cancel, cancel, checkParameterTypesAgainstCompilation, close, closeAll, compile, deletePersistentAll, deletePersistentAll, deletePersistentAll, execute, executeQuery, getBooleanExtensionProperty, getCandidateClass, getCandidateClassName, getCompilation, getDatastoreReadTimeoutMillis, getDatastoreWriteTimeoutMillis, getExplicitParameters, getExplicitVariables, getExtension, getExtensions, getFetchPlan, getFilter, getFrom, getGrouping, getHaving, getIgnoreCache, getImplicitParameters, getImports, getInputParameters, getObjectManager, getOrdering, getParameterMapForValues, getParsedImports, getQueryManager, getRange, getRangeFromIncl, getRangeFromInclParam, getRangeToExcl, getRangeToExclParam, getResult, getResultClass, getResultClassName, getResultDistinct, getSerializeRead, getStoreManager, getSubqueryForVariable, getSupportedExtensions, getType, getUpdate, hashCode, hasSubqueryForVariable, isSubclasses, isUnique, isUnmodifiable, performExecuteInternal, performExecuteTask, prepareDatastore, resolveClassDeclaration, setCandidateClassName, setClass, setCompilation, setDatastoreReadTimeoutMillis, setDatastoreWriteTimeoutMillis, setExtensions, setFetchPlan, setFrom, setHaving, setIgnoreCache, setImplicitParameter, setImplicitParameter, setRange, setRange, setResultClassName, setResultDistinct, setSerializeRead, setType, setUnique, setUnmodifiable, setUpdate, supportsTimeout, useCaching, useFetchPlan, useResultsCaching
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER_DB4O

protected static final org.datanucleus.util.Localiser LOCALISER_DB4O
Localiser for messages.


isCompiled

protected transient boolean isCompiled
State variable for the compilation state

Constructor Detail

SQLQuery

public SQLQuery(org.datanucleus.ObjectManager om,
                SQLQuery query)
Constructor for a new query using the existing query.

Parameters:
om - ObjectManager
query - The existing query

SQLQuery

public SQLQuery(org.datanucleus.ObjectManager om)
Constructs a new query instance having the same criteria as the given query.

Parameters:
om - The ObjectManager

SQLQuery

public SQLQuery(org.datanucleus.ObjectManager om,
                java.lang.String sqlText)
Constructs a new query instance having the same criteria as the given query.

Parameters:
om - The ObjectManager
sqlText - The SQL query string
Method Detail

equals

public boolean equals(java.lang.Object obj)
Equality operator. Returns true if the other object is of this type and if the input SQL string is the same.

Overrides:
equals in class org.datanucleus.store.query.Query
Parameters:
obj - The object to compare against
Returns:
Whether they are equal

discardCompiled

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

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

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

compileInternal

public void compileInternal(boolean forExecute,
                            java.util.Map parameterValues)
Verify the elements of the query and provide a hint to the query to prepare and optimize an execution plan.

Specified by:
compileInternal in class org.datanucleus.store.query.Query

performExecute

protected java.lang.Object performExecute(java.util.Map parameters)
Execute the query and return the result. For a SELECT query this will be the QueryResult. For an UPDATE/DELETE it will be the row count for the update statement.

Specified by:
performExecute in class org.datanucleus.store.query.Query
Parameters:
parameters - the Map containing all of the parameters (positional parameters)
Returns:
the result of the query

generateQueryStatement

protected java.lang.String generateQueryStatement()
Method to perform any necessary pre-processing on the users query statement before we execute it. SQL queries are not modified in any way, as per JDO2 spec [14.7].

Returns:
The compiled SQL statement


Copyright © 2010. All Rights Reserved.