Package org.apache.openjpa.jdbc.kernel
Class PreparedQueryImpl
- java.lang.Object
-
- org.apache.openjpa.jdbc.kernel.PreparedQueryImpl
-
- All Implemented Interfaces:
PreparedQuery
public class PreparedQueryImpl extends java.lang.Object implements PreparedQuery
ImplementsPreparedQueryfor SQL queries. PreparedQuery holds the post-compilation and post-execution state of a kernel Query. The post-execution internal state of a query is appended as a user object to the user-visible result to maintain the API contract.- Author:
- Pinaki Poddar
-
-
Constructor Summary
Constructors Constructor Description PreparedQueryImpl(java.lang.String id, java.lang.String sql, Query compiled)Construct.PreparedQueryImpl(java.lang.String id, Query compiled)Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetIdentifier()Get the immutable identifier of this receiver used for *cache.java.lang.StringgetLanguage()Gets the language in which this query is expressed.java.lang.StringgetOriginalQuery()Get the original query string which is same as the identifier of this receiver.java.lang.Class[]getProjectionTypes()QueryExpressions[]getQueryExpressions()java.lang.StringgetTargetQuery()Get the target database query.PreparedQueryCache.Exclusioninitialize(java.lang.Object result)Initialize this receiver with post-execution result.booleanisInitialized()Affirms if this receiver has been initialized.java.util.Map<java.lang.Integer,java.lang.Object>reparametrize(java.util.Map user, Broker broker)Merge the given user parameters with its own parameter.voidsetInto(Query q)Pours the post-compilation state held by this receiver to the given query.java.lang.StringtoString()
-
-
-
Constructor Detail
-
PreparedQueryImpl
public PreparedQueryImpl(java.lang.String id, Query compiled)Construct.- Parameters:
id- an identifier for this query to be used as cache keycompiled- a compiled query
-
PreparedQueryImpl
public PreparedQueryImpl(java.lang.String id, java.lang.String sql, Query compiled)Construct.- Parameters:
id- an identifier for this query to be used as cache keycorresponding- data store language query stringcompiled- a compiled query
-
-
Method Detail
-
getIdentifier
public java.lang.String getIdentifier()
Description copied from interface:PreparedQueryGet the immutable identifier of this receiver used for *cache.- Specified by:
getIdentifierin interfacePreparedQuery
-
getLanguage
public java.lang.String getLanguage()
Description copied from interface:PreparedQueryGets the language in which this query is expressed.- Specified by:
getLanguagein interfacePreparedQuery
-
getOriginalQuery
public java.lang.String getOriginalQuery()
Get the original query string which is same as the identifier of this receiver.- Specified by:
getOriginalQueryin interfacePreparedQuery
-
getTargetQuery
public java.lang.String getTargetQuery()
Description copied from interface:PreparedQueryGet the target database query.- Specified by:
getTargetQueryin interfacePreparedQuery
-
isInitialized
public boolean isInitialized()
Description copied from interface:PreparedQueryAffirms if this receiver has been initialized.- Specified by:
isInitializedin interfacePreparedQuery
-
getQueryExpressions
public QueryExpressions[] getQueryExpressions()
-
getProjectionTypes
public java.lang.Class[] getProjectionTypes()
-
setInto
public void setInto(Query q)
Pours the post-compilation state held by this receiver to the given query.- Specified by:
setIntoin interfacePreparedQuery- Parameters:
q- A Query which has been substituted by this receiver and hence does not have its post-compilation state.
-
initialize
public PreparedQueryCache.Exclusion initialize(java.lang.Object result)
Initialize this receiver with post-execution result. The input argument is processed only if it is aResultListwith an attachedSelectResultObjectProvideras itsuser object.- Specified by:
initializein interfacePreparedQuery- Parameters:
result- an opaque instance supposed to carry post-execution data such as target database query, parameters of the query etc.- Returns:
- an exclusion if can not be initialized for some reason. null if initialization is successful.
-
reparametrize
public java.util.Map<java.lang.Integer,java.lang.Object> reparametrize(java.util.Map user, Broker broker)Merge the given user parameters with its own parameter. The given map must be compatible with the user parameters extracted duringinitialization.- Specified by:
reparametrizein interfacePreparedQuery- Parameters:
user- the map of parameter key and value set by the user on the original query.- Returns:
- 0-based parameter index mapped to corresponding values.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-