com.boylesoftware.cb2
Interface QueryParamProcessor

All Superinterfaces:
DAOPlugin

public interface QueryParamProcessor
extends DAOPlugin

Interface for DAO plugins that perform additional processing of query parameters just before they get set into a prepared statement during a DAO call.

Multiple QueryParamProcessor plugins can be installed for one DAO. In this case they will be called in the order, in which their <plugin> elements appear in the DAO configuration. Each processor gets at its input parameter value returned by the previous one.

One instance of a QueryParamProcessor plugin can be shared by multiple threads at the same time.

Version:
$Id: QueryParamProcessor.java,v 1.3 2004/04/20 16:00:58 levahim Exp $
Author:
Lev Himmelfarb

Method Summary
 java.lang.Object processQueryParam(java.sql.PreparedStatement pstmt, int placeholderIndex, java.lang.Object queryParam)
          This method is called by the DAO just before a query parameter gets set into a java.sql.PreparedStatement.
 
Methods inherited from interface com.boylesoftware.cb2.DAOPlugin
setApplicationContext
 

Method Detail

processQueryParam

public java.lang.Object processQueryParam(java.sql.PreparedStatement pstmt,
                                          int placeholderIndex,
                                          java.lang.Object queryParam)
                                   throws java.sql.SQLException
This method is called by the DAO just before a query parameter gets set into a java.sql.PreparedStatement. The method returns an object, which will be actually used by the DAO and set into the statement.

Note, that for array query parameters the method is called once for the whole array and then one time for each of its element.

This method should not set the parameter by itself. The pstmt argument is given to it only for reference.

Parameters:
pstmt - reference to the prepared statement object, into which the parameter is going to be set.
placeholderIndex - index of the placeholder in the prepared statement, into which the parameter is going to be set.
queryParam - the original value of the parameter. May be null, an object, or an array of objects.
Returns:
value of the parameter to be actually set into the statement.
Throws:
java.sql.SQLException - if an error happens.


Copyright © 2002,2003,2004 - Boyle Software, Inc.