Modifier and Type | Field and Description |
---|---|
protected String |
sql |
protected Statement |
statement |
Modifier | Constructor and Description |
---|---|
protected |
Sql.AbstractQueryCommand(String sql) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeResources()
After performing the execute operation and making use of its return, it's necessary
to free the resources allocated for the statement.
|
protected 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 ResultSet |
execute()
Execute the command that's defined by the subclass following
the Command pattern.
|
protected abstract ResultSet |
runQuery(Connection connection)
Perform the query.
|
protected Sql.AbstractQueryCommand(String sql)
protected final ResultSet execute() throws SQLException
SQLException
- if a database error occursprotected final void closeResources()
protected final void closeResources(ResultSet rs)
rs
- allows the caller to conveniently close its resource as wellprotected abstract ResultSet runQuery(Connection connection) throws SQLException
execute()
) method can clean up.
This is the method that encloses the variant part of the code.connection
- the connection to useSQLException
- if a database error occurs