Executes a SQL query as a prepared statement, setting its fields to the elements of the vararg passed, returning a list of values in the first column of each row in the results @param query The SQL query to execute @param fields A vararg of the fields to set in the prepared statement @param
(String query, Object... fields)
| 340 | * @return A list of the value in the first column of each row returned by the query |
| 341 | */ |
| 342 | public <T> List<T> queryResultList(String query, Object... fields) { |
| 343 | List<T> list = new ArrayList<>(); |
| 344 | try { |
| 345 | PreparedStatement statement = prepareStatement(query, fields); |
| 346 | ResultSet results = statement.executeQuery(); |
| 347 | while (results.next()) { |
| 348 | list.add((T) results.getObject(1)); |
| 349 | } |
| 350 | results.close(); |
| 351 | statement.close(); |
| 352 | } catch (SQLException e) { |
| 353 | sneakyThrow(e); |
| 354 | } |
| 355 | return list; |
| 356 | } |
| 357 | |
| 358 | /** |
| 359 | * Executes a SQL query as a prepared statement, setting its fields to the elements of the vararg passed, |
nothing calls this directly
no test coverage detected