Package groovy.sql
Class Sql.AbstractQueryCommand
java.lang.Object
groovy.sql.Sql.AbstractQueryCommand
- Enclosing class:
- Sql
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
After performing the execute operation and making use of its return, it's necessary to free the resources allocated for the statement.protected final void
After performing the execute operation and making use of its return, it's necessary to free the resources allocated for the statement.protected final ResultSet
execute()
Execute the command that's defined by the subclass following the Command pattern.protected abstract ResultSet
runQuery
(Connection connection) Perform the query.
-
Field Details
-
sql
-
statement
-
-
Constructor Details
-
AbstractQueryCommand
-
-
Method Details
-
execute
Execute the command that's defined by the subclass following the Command pattern. Specialized parameters are held in the command instances.- Returns:
- ResultSet from executing a query
- Throws:
SQLException
- if a database error occurs
-
closeResources
protected 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
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
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
-