Here you can find the source of executeUpdate(PreparedStatement preparedStatement, List
Parameter | Description |
---|---|
preparedStatement | a parameter |
paramList | a parameter |
Parameter | Description |
---|---|
SQLException | an exception |
public static boolean executeUpdate(PreparedStatement preparedStatement, List<Object> paramList)
//package com.java2s; //License from project: Open Source License import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; public class Main { /**/*from ww w .j a v a2 s.c om*/ * Generic update function. * * @param preparedStatement * @param paramList * @throws SQLException */ public static boolean executeUpdate(PreparedStatement preparedStatement, List<Object> paramList) { try { int i = 1; for (Object param : paramList) { if (param instanceof String) { preparedStatement.setString(i, String.valueOf(param)); } i++; } preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); return false; } return true; } }