org.apache.ojb.odmg.oql
Class OQLQueryImpl

java.lang.Object
  extended by org.apache.ojb.odmg.oql.OQLQueryImpl
All Implemented Interfaces:
Configurable, EnhancedOQLQuery, OQLQuery

public class OQLQueryImpl
extends Object
implements EnhancedOQLQuery, Configurable

The OQL query interface implementation.

Version:
$Id: OQLQueryImpl.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $

Constructor Summary
OQLQueryImpl(ImplementationImpl odmg)
           
OQLQueryImpl(PBKey pbKey)
          Deprecated.  
 
Method Summary
 void bind(Object parameter)
          Bind a parameter to the query.
 void configure(Configuration pConfig)
          configure an object using the Configuration pConfig
 void create(String queryString)
          Create an OQL query from the string parameter.
 void create(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.
 Object execute()
          Execute the query.
 int fullSize()
          Deprecated method.
protected  ListIterator getBindIterator()
          Gets the bindIterator.
protected  Class getCollectionClass()
          returns the collection type to be used to contain oql query result sets
protected  OdmgConfiguration getConfiguration()
           
 Query getQuery()
          returns the compiled query object
protected  void performLockingIfRequired(TransactionImpl tx, PersistenceBroker broker, ManageableCollection result)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OQLQueryImpl

public OQLQueryImpl(ImplementationImpl odmg)

OQLQueryImpl

public OQLQueryImpl(PBKey pbKey)
Deprecated. 

Parameters:
pbKey -
Method Detail

getQuery

public Query getQuery()
returns the compiled query object


getCollectionClass

protected Class getCollectionClass()
returns the collection type to be used to contain oql query result sets


bind

public void bind(Object parameter)
          throws QueryParameterCountInvalidException,
                 QueryParameterTypeInvalidException
Bind a parameter to the query. A parameter is denoted in the query string passed to 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.

Specified by:
bind in interface OQLQuery
Parameters:
parameter - A value to be substituted for a query parameter.
Throws:
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.

create

public void create(String queryString)
            throws QueryInvalidException
Create an OQL query from the string parameter. In order to execute a query, an 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.

Specified by:
create in interface OQLQuery
Parameters:
queryString - An OQL query.
Throws:
QueryInvalidException - The query syntax is invalid.

create

public void create(String queryString,
                   int startAtIndex,
                   int endAtIndex)
            throws QueryInvalidException
Description copied from interface: EnhancedOQLQuery
An extension of the OQLQuery.create(String) method, which additionally allow to specify an start- and end-Index for the query.

Specified by:
create in interface EnhancedOQLQuery
Parameters:
queryString - An oql query string.
startAtIndex - The start index.
endAtIndex - The end index.
Throws:
QueryInvalidException - The type of the parameter does not correspond with the type of the parameter in the query.

execute

public Object execute()
               throws QueryException
Execute the query. After executing a query, the parameter list is reset. Some implementations may throw additional exceptions that are also derived from ODMGException.

Specified by:
execute in interface OQLQuery
Returns:
The object that represents the result of the query. The returned data, whatever its OQL type, is encapsulated into an object. For instance, when OQL returns an integer, the result is put into an 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).
Throws:
QueryException - An exception has occurred while executing the query.

performLockingIfRequired

protected void performLockingIfRequired(TransactionImpl tx,
                                        PersistenceBroker broker,
                                        ManageableCollection result)

getConfiguration

protected OdmgConfiguration getConfiguration()

getBindIterator

protected ListIterator getBindIterator()
Gets the bindIterator.

Returns:
Returns a ListIterator

configure

public void configure(Configuration pConfig)
               throws ConfigurationException
Description copied from interface: Configurable
configure an object using the Configuration pConfig

Specified by:
configure in interface Configurable
Parameters:
pConfig - the Configuration object used to configure current instance
Throws:
ConfigurationException
See Also:
Configurable.configure(Configuration)

fullSize

public int fullSize()
Description copied from interface: EnhancedOQLQuery
Deprecated method.

Specified by:
fullSize in interface EnhancedOQLQuery


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.