Executes a SQL query as a prepared statement, setting its fields to the elements of the vararg passed, returning the value in the first column of the first row in the results as a Bytes. @param query The SQL query to execute @param fields A vararg of the fields to set in the prepared statement @re
(String query, Object... fields)
| 287 | * @return The bytes in the first column of the first row of the returned results, or null if none is present |
| 288 | */ |
| 289 | public byte[] querySingleResultBytes(String query, Object... fields) { |
| 290 | try { |
| 291 | PreparedStatement statement = prepareStatement(query, fields); |
| 292 | ResultSet results = statement.executeQuery(); |
| 293 | if (!results.next()) { |
| 294 | return null; |
| 295 | } |
| 296 | byte[] val = results.getBytes(1); |
| 297 | results.close(); |
| 298 | statement.close(); |
| 299 | return val; |
| 300 | } catch (SQLException e) { |
| 301 | sneakyThrow(e); |
| 302 | return null; |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * 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