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 int |
getMaxRows()
Get the maximum number of rows to return in the ResultSet
|
protected abstract ResultSet |
runQuery(Connection connection)
Perform the query.
|
protected void |
setMaxRows(int maxRows)
Set the maximum number of rows to return in the ResultSet
|
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 occursprotected void setMaxRows(int maxRows)
maxRows
- the maximum number of rowsprotected int getMaxRows()