The use of parameters in a Query is implemented by a basic interface, atg.repository.ParameterSupportView, which extends atg.repository.RepositoryView. The ParameterSupportView interface provides additional method signatures to the executeQuery() methods provided in RepositoryView. This means that for every executeQuery() method, there is a similar one with an optional Object[] argument representing parameter values for any parameters in the Query that is passed in. For example:

public RepositoryItem[] executeQuery(Query pQuery,
       Object[] pParameterValues)

Each element in the pParameterValues array corresponds to a parameter in the given Query. pParameterValues[0] corresponds to the first parameter in the Query, pParameterValues[1] corresponds to the second parameter in the Query, and so on. When you create a Query, you must remember the number of parameters and their order, especially in the case of compound queries that use AND and OR operators. You can use the Query.getQueryRepresentation() method to obtain a string of the query representation including all parameter locations.

Also, the atg.repository.QueryBuilder interface is extended by an interface named atg.repository.ParameterSupportQueryBuilder. This interface adds a single method to create a parameter QueryExpression that can be used in queries created by the ParameterSupportQueryBuilder:

public QueryExpression createParameterQueryExpression()
    throws RepositoryException

The atg.adapter.gsa.GSAView class used by the SQL repository implements the atg.repository.ParameterSupportView interface, and the atg.adapter.gsa.query.Builder class implements the atg.repository.ParameterSupportQueryBuilder interface. This makes parameterized queries available in the SQL repository.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices