com.boylesoftware.cb2
Interface QueryParamSetter

All Superinterfaces:
DAOPlugin

public interface QueryParamSetter
extends DAOPlugin

Interface for the DAO plugin, which is responsible for setting query parameters into JDBC prepared statements during a DAO call. The DAO does not call this plugin for nulls, nor it calls it for arrays. In the case of nulls the DAO always calls setNull on the java.sql.PreparedStatement internally. For arrays, it automatically breaks them down onto individual elements and then calls the plugin for each element.

Only one plugin of this type can be installed in a DAO configuration. If none installed, the DAO will use a simple internal implementation, which calls setObject on the java.sql.PreparedStatement.

Note, that one instance of the plugin can be shared by multiple threads at the same time.

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

Method Summary
 void setQueryParam(java.sql.PreparedStatement pstmt, int placeholderIndex, java.lang.Object queryParam, java.lang.Integer sqlType)
          Sets the specified query parameter into the specified prepared statement.
 
Methods inherited from interface com.boylesoftware.cb2.DAOPlugin
setApplicationContext
 

Method Detail

setQueryParam

public void setQueryParam(java.sql.PreparedStatement pstmt,
                          int placeholderIndex,
                          java.lang.Object queryParam,
                          java.lang.Integer sqlType)
                   throws java.sql.SQLException
Sets the specified query parameter into the specified prepared statement.

Parameters:
pstmt - the statement.
placeholderIndex - the parameter index.
queryParam - the value to set, never can be an array nor null.
sqlType - target SQL type (see java.sql.Types), or null if not specified.
Throws:
java.sql.SQLException - if an error happens.


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