Useful helper method which handles resource management when executing a query which returns a result set. Derived classes of Sql can override "createQueryCommand" and then call this method to access the ResultSet returned from the provided query or alternatively can use the higher-level method of Sq
(String sql)
| 4511 | * @throws SQLException if a database error occurs |
| 4512 | */ |
| 4513 | protected final ResultSet executeQuery(String sql) throws SQLException { |
| 4514 | AbstractQueryCommand command = createQueryCommand(sql); |
| 4515 | ResultSet rs = null; |
| 4516 | try { |
| 4517 | rs = command.execute(); |
| 4518 | } finally { |
| 4519 | command.closeResources(); |
| 4520 | } |
| 4521 | return rs; |
| 4522 | } |
| 4523 | |
| 4524 | /** |
| 4525 | * Useful helper method which handles resource management when executing a |
no test coverage detected