protected static PreparedStatement createByIterator ( Connection conn , String sql , Iterator < ? > parameters ) throws SQLException { PreparedStatement ps = conn . prepareStatement ( sql ) ; if ( parameters != null ) { int index = 1 ; while ( parameters . hasNext ( ) ) { Object parameter = parameters . next ( ) ; if ( parameter == null ) { ps . setObject ( index , null ) ; } else { ps . setObject ( index , parameter ) ; } index ++ ; } } return ps ; }
Support ? as parameter