public void setParams(PreparedStatement pstmt) throws SQLException {
        for (int i=0; i<params.size(); i++) {
            Object param = params.get(i);
            int type = types.get(i);
            // Set param, noting fact that params start at 1 and not 0.
            switch(type) {
                case Types.INTEGER:
                    pstmt.setInt(i+1, (Integer)param);
                    break;
                case Types.BIGINT:
                    pstmt.setLong(i+1, (Long)param);
                    break;
                case Types.VARCHAR:
                    pstmt.setString(i+1, (String)param);
                    break;
                case Types.BOOLEAN:
                    pstmt.setBoolean(i+1, (Boolean)param);
            }
        }
    }
Sets all parameters on the given PreparedStatement. The standard code block
for turning a CachedPreparedStatement into a PreparedStatement is as follows:

<pre>
PreparedStatement pstmt = con.prepareStatement(cachedPstmt.getSQL());
cachedPstmt.setParams(pstmt);
</pre>

@param pstmt the prepared statement.
@throws java.sql.SQLException if an SQL Exception occurs.
xmppserver/src/main/java/org/jivesoftware/database/CachedPreparedStatement.java