protected abstract class Sql.AbstractQueryCommand
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
sql |
protected java.sql.Statement |
statement |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractQueryCommand(java.lang.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(java.sql.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 java.sql.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 java.sql.ResultSet |
runQuery(java.sql.Connection connection)
Perform the query.
|
protected void |
setMaxRows(int maxRows)
Set the maximum number of rows to return in the ResultSet
|
protected final java.lang.String sql
protected java.sql.Statement statement
protected final java.sql.ResultSet execute()
throws java.sql.SQLException
java.sql.SQLException - if a database error occursprotected final void closeResources()
protected final void closeResources(java.sql.ResultSet rs)
rs - allows the caller to conveniently close its resource as wellprotected abstract java.sql.ResultSet runQuery(java.sql.Connection connection)
throws java.sql.SQLException
execute()) method can clean up.
This is the method that encloses the variant part of the code.connection - the connection to usejava.sql.SQLException - if a database error occursprotected void setMaxRows(int maxRows)
maxRows - the maximum number of rowsprotected int getMaxRows()