public class OQLQueryImpl extends java.lang.Object implements EnhancedOQLQuery, org.apache.ojb.broker.util.configuration.Configurable
Constructor and Description |
---|
OQLQueryImpl(ImplementationImpl odmg) |
OQLQueryImpl(PBKey pbKey)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(java.lang.Object parameter)
Bind a parameter to the query.
|
void |
configure(org.apache.ojb.broker.util.configuration.Configuration pConfig)
configure an object using the Configuration pConfig
|
void |
create(java.lang.String queryString)
Create an OQL query from the string parameter.
|
void |
create(java.lang.String queryString,
int startAtIndex,
int endAtIndex)
An extension of the
OQLQuery.create(String) method, which
additionally allow to specify an start- and end-Index for
the query. |
java.lang.Object |
execute()
Execute the query.
|
int |
fullSize()
Deprecated method.
|
Query |
getQuery()
returns the compiled query object
|
public OQLQueryImpl(ImplementationImpl odmg)
public OQLQueryImpl(PBKey pbKey)
pbKey
- public Query getQuery()
public void bind(java.lang.Object parameter) throws QueryParameterCountInvalidException, QueryParameterTypeInvalidException
create
by $i,
where i is the rank of the parameter, beginning with 1.
The parameters are set consecutively by calling this method bind
.
The ith variable is set by the ith call to the bind
method.
If any of the $i are not set by a call to bind
at the point
execute
is called, QueryParameterCountInvalidException
is thrown.
The parameters must be objects, and the result is an Object
.
Objects must be used instead of primitive types (Integer
instead
of int
) for passing the parameters.
If the parameter is of the wrong type,
QueryParameterTypeInvalidException
is thrown.
After executing a query, the parameter list is reset.
bind
in interface OQLQuery
parameter
- A value to be substituted for a query parameter.QueryParameterCountInvalidException
- The number of calls to
bind
has exceeded the number of parameters in the query.QueryParameterTypeInvalidException
- The type of the parameter does
not correspond with the type of the parameter in the query.public void create(java.lang.String queryString) throws QueryInvalidException
OQLQuery
object must be created
by calling Implementation.newOQLQuery
, then calling the
create
method with the query string.
The create
method might throw QueryInvalidException
if the query could not be compiled properly. Some implementations may not want
to compile the query before execute
is called. In this case
QueryInvalidException
is thrown when execute
is called.create
in interface OQLQuery
queryString
- An OQL query.QueryInvalidException
- The query syntax is invalid.public void create(java.lang.String queryString, int startAtIndex, int endAtIndex) throws QueryInvalidException
EnhancedOQLQuery
OQLQuery.create(String)
method, which
additionally allow to specify an start- and end-Index for
the query.create
in interface EnhancedOQLQuery
queryString
- An oql query string.startAtIndex
- The start index.endAtIndex
- The end index.QueryInvalidException
- The type of the parameter does
not correspond with the type of the parameter in the query.public java.lang.Object execute() throws QueryException
ODMGException
.execute
in interface OQLQuery
Integer
object. When OQL returns a collection (literal or object),
the result is always a Java collection object of the same kind
(for instance, a DList
).QueryException
- An exception has occurred while executing the query.public void configure(org.apache.ojb.broker.util.configuration.Configuration pConfig) throws org.apache.ojb.broker.util.configuration.ConfigurationException
org.apache.ojb.broker.util.configuration.Configurable
configure
in interface org.apache.ojb.broker.util.configuration.Configurable
pConfig
- the Configuration object used to configure current instanceorg.apache.ojb.broker.util.configuration.ConfigurationException
Configurable.configure(Configuration)
public int fullSize()
EnhancedOQLQuery
fullSize
in interface EnhancedOQLQuery
(C) 2002 - 2005 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30