Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.sql
[Java] Class Sql.AbstractQueryCommand

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

    protected abstract class Sql.AbstractQueryCommand

Field Summary
`protected java.lang.String` | `sql`
`protected Statement` | `statement`

Constructor Summary
`protected Sql.AbstractQueryCommand(java.lang.String sql)`

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

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### sql

    protected final java.lang.String sql

### statement

    protected Statement statement

Constructor Detail

### Sql.AbstractQueryCommand

    protected Sql.AbstractQueryCommand(java.lang.String sql)

Method Detail

### closeResources

    protected final void closeResources()

  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.
  throws:
    SQLException if a database error occurs
  Parameters:
    `connection` - the connection to use
  Returns:
    ResultSet from an executeQuery method.

### closeResources

    protected final void closeResources(java.sql.ResultSet rs)

### execute

    protected final java.sql.ResultSet execute()

  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 java.sql.ResultSet runQuery(java.sql.Connection connection)

Groovy Documentation