Executes a SQL query as a prepared statement, setting its fields to the elements of the vararg passed, returning a String 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 @retur
(String query, Object... fields)
| 366 | * column can be parsed into one. |
| 367 | */ |
| 368 | public List<String> queryResultStringList(String query, Object... fields) { |
| 369 | List<String> list = new ArrayList<>(); |
| 370 | try { |
| 371 | PreparedStatement statement = prepareStatement(query, fields); |
| 372 | ResultSet results = statement.executeQuery(); |
| 373 | while (results.next()) { |
| 374 | list.add(results.getString(1)); |
| 375 | } |
| 376 | results.close(); |
| 377 | statement.close(); |
| 378 | } catch (SQLException e) { |
| 379 | sneakyThrow(e); |
| 380 | } |
| 381 | return list; |
| 382 | } |
| 383 | |
| 384 | /** |
| 385 | * 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