Package org.odmg
Interface OQLQuery
- All Known Implementing Classes:
RasOQLQuery
public interface OQLQuery
The interface to an OQL query object.
- Author:
- David Jordan (as Java Editor of the Object Data Management Group)
-
Method Summary
-
Method Details
-
create
Create an OQL query from the string parameter. In order to execute a query, anOQLQueryobject must be created by callingImplementation.newOQLQuery, then calling thecreatemethod with the query string. Thecreatemethod might throwQueryInvalidExceptionif the query could not be compiled properly. Some implementations may not want to compile the query beforeexecuteis called. In this caseQueryInvalidExceptionis thrown whenexecuteis called.- Parameters:
query- An OQL query.- Throws:
QueryInvalidException- The query syntax is invalid.
-
bind
void bind(Object parameter) throws QueryParameterCountInvalidException, QueryParameterTypeInvalidException Bind a parameter to the query. A parameter is denoted in the query string passed tocreateby $i, where i is the rank of the parameter, beginning with 1. The parameters are set consecutively by calling this methodbind. The ith variable is set by the ith call to thebindmethod. If any of the $i are not set by a call tobindat the pointexecuteis called,QueryParameterCountInvalidExceptionis thrown. The parameters must be objects, and the result is anObject. Objects must be used instead of primitive types (Integerinstead ofint) for passing the parameters.If the parameter is of the wrong type,
QueryParameterTypeInvalidExceptionis thrown. After executing a query, the parameter list is reset.- Parameters:
parameter- A value to be substituted for a query parameter.- Throws:
QueryParameterCountInvalidException- The number of calls tobindhas 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.
-
execute
Execute the query. After executing a query, the parameter list is reset. Some implementations may throw additional exceptions that are also derived fromODMGException.- 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
Integerobject. When OQL returns a collection (literal or object), the result is always a Java collection object of the same kind (for instance, aDList). - Throws:
QueryException- An exception has occurred while executing the query.
-