groovy.sql

## Class Sql.AbstractQueryCommand

- java.lang.Object
- - groovy.sql.Sql.AbstractQueryCommand

Direct Known Subclasses:
  Sql.PreparedQueryCommand, Sql.QueryCommand

Enclosing class:
  Sql

    protected abstract class Sql.AbstractQueryCommand
    extends Object

### Field Summary

Fields
`protected String` `sql`
`protected Statement` `statement`

### Method Summary

Methods
`void` `closeResources()` After performing the execute operation and making use of its return, it's necessary to free the resources allocated for the statement.
`void` `closeResources(ResultSet rs)` After performing the execute operation and making use of its return, it's necessary to free the resources allocated for the statement.
`protected abstract ResultSet` `runQuery(Connection connection)` Perform the query.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### sql

    protected final String sql

#### statement

    protected Statement statement

### Method Detail

#### closeResources

    public final void closeResources()

After performing the execute operation and making use of its return, it's necessary to free the resources allocated for the statement.

#### closeResources

    public final void closeResources(ResultSet rs)

After performing the execute operation and making use of its return, it's necessary to free the resources allocated for the statement.

Parameters:
  `rs` - allows the caller to conveniently close its resource as well

#### runQuery

    protected abstract ResultSet runQuery(Connection connection)
                                   throws SQLException

Perform the query. Must set statement field so that the main (`execute()`) method can clean up. This is the method that encloses the variant part of the code.

Parameters:
  `connection` - the connection to use
Returns:
  ResultSet from an executeQuery method.
Throws:
  `SQLException` - if a database error occurs