Here you can find the source of fillStatement(PreparedStatement ps,Object...params)
Parameter | Description |
---|---|
ps | a parameter |
params | a parameter |
public static PreparedStatement fillStatement(PreparedStatement ps,Object...params)
//package com.java2s; //License from project: Apache License import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; public class Main { /**//from w ww. j a v a 2s . c o m * Fill a raw PreparedStatement to make it executable. * @param ps * @param params * @return */ public static PreparedStatement fillStatement(PreparedStatement ps, Object... params) { try { for (int i = 0; i < params.length; i++) { ps.setObject(i + 1, params[i]); } } catch (SQLException e) { e.printStackTrace(); } return ps; } /** * Fill a raw PreparedStatement to make it executable. * @param ps * @param params * @return */ public static PreparedStatement fillStatement(PreparedStatement ps, List<Object> params) { return fillStatement(ps, params.toArray()); } }