Package org.apache.openjpa.jdbc.kernel
Class PreparedQueryImpl
java.lang.Object
org.apache.openjpa.jdbc.kernel.PreparedQueryImpl
- All Implemented Interfaces:
PreparedQuery
Implements
PreparedQuery
for 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
ConstructorDescriptionPreparedQueryImpl
(String id, String sql, Query compiled) Construct.PreparedQueryImpl
(String id, Query compiled) Construct. -
Method Summary
Modifier and TypeMethodDescriptionGet the immutable identifier of this receiver used for *cache
.Gets the language in which this query is expressed.Get the original query string which is same as the identifier of this receiver.Class[]
Get the target database query.initialize
(Object result) Initialize this receiver with post-execution result.boolean
Affirms if this receiver has been initialized.reparametrize
(Map user, Broker broker) Merge the given user parameters with its own parameter.void
Pours the post-compilation state held by this receiver to the given query.toString()
-
Constructor Details
-
PreparedQueryImpl
Construct.- Parameters:
id
- an identifier for this query to be used as cache keycompiled
- a compiled query
-
PreparedQueryImpl
Construct.- Parameters:
id
- an identifier for this query to be used as cache keycorresponding
- data store language query stringcompiled
- a compiled query
-
-
Method Details
-
getIdentifier
Description copied from interface:PreparedQuery
Get the immutable identifier of this receiver used for *cache
.- Specified by:
getIdentifier
in interfacePreparedQuery
-
getLanguage
Description copied from interface:PreparedQuery
Gets the language in which this query is expressed.- Specified by:
getLanguage
in interfacePreparedQuery
-
getOriginalQuery
Get the original query string which is same as the identifier of this receiver.- Specified by:
getOriginalQuery
in interfacePreparedQuery
-
getTargetQuery
Description copied from interface:PreparedQuery
Get the target database query.- Specified by:
getTargetQuery
in interfacePreparedQuery
-
isInitialized
public boolean isInitialized()Description copied from interface:PreparedQuery
Affirms if this receiver has been initialized.- Specified by:
isInitialized
in interfacePreparedQuery
-
getQueryExpressions
-
getProjectionTypes
-
setInto
Pours the post-compilation state held by this receiver to the given query.- Specified by:
setInto
in interfacePreparedQuery
- Parameters:
q
- A Query which has been substituted by this receiver and hence does not have its post-compilation state.
-
initialize
Initialize this receiver with post-execution result. The input argument is processed only if it is aResultList
with an attachedSelectResultObjectProvider
as itsuser object
.- Specified by:
initialize
in 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
Merge the given user parameters with its own parameter. The given map must be compatible with the user parameters extracted duringinitialization
.- Specified by:
reparametrize
in 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
-