public void executeUpdate(String sql, Object... params) throws SQLException { this.checkConnection(); SQLQuery query = new SQLQuery(sql, params); query.execute(); }
public void insert(String table, String[] fields, List<Object[]> rows) throws SQLException { this.checkConnection(); String[] fieldPlaceholders = new String[fields.length]; Arrays.fill(fieldPlaceholders, "?"); String sql = "INSERT INTO `" + table + "` (`" + StringUtils.implode(fields, "`, `") + "`) VALUES (" + StringUtils.implode(fieldPlaceholders, ", ") + ");"; SQLQuery query = new SQLQuery(sql); for (Object[] params : rows) { query.bindParams(params); query.execute(); } }