com.sptci.rwt
Class QueryExecutor
java.lang.Object
com.sptci.rwt.AbstractQueryExecutor
com.sptci.rwt.QueryExecutor
public class QueryExecutor
- extends AbstractQueryExecutor
A utility class to execute SQL statement (only one statement allowed).
© Copyright 2007 Sans Pareil Technologies, Inc.
- Version:
- $Id: QueryExecutor.java 4123 2008-05-25 21:49:01Z rakesh $
- Author:
- Rakesh Vidyadharan 2007-10-01
- See Also:
BatchQueryExecutor
|
Method Summary |
Rows |
execute(String sql,
int... parameters)
Execute the specified statement and return a Rows
object that represent the data in the ResultSet
obtained by executing the statement. |
int |
getTotalRows(String sql)
Return the total number of rows that can be retrieved by executing the
specified SQL statement. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QueryExecutor
public QueryExecutor(ConnectionManager manager)
- Create a new instance using the specified manager to fetch connections.
- Parameters:
manager - The connection manager to use.
execute
public Rows execute(String sql,
int... parameters)
throws SQLException
- Execute the specified statement and return a
Rows
object that represent the data in the ResultSet
obtained by executing the statement.
- Parameters:
sql - The statement to be executed.parameters - Additional parameters to specify the following values
in the order listed:
maxRows The maximum number of rows to fetch from
the database.
page The current page of data being viewed. Page
is specified using zero based indexing.
rowsPerPage The number of rows of data to display
on a page .
maxColumnLength The maximum length for a column
value. This is used to truncate the value of CLOB
type objects to avoid memory issues.
Note that specifying page should be combined with
specifying rowsPerPage for proper behaviour. A default
value of 100 will be used otherwise.
- Returns:
- The value object representing rows in the specified range in
the
ResultSet.
- Throws:
SQLException - If errors are encountered while executing the
statement.- See Also:
AbstractQueryExecutor.createStatement(java.sql.Connection),
AbstractQueryExecutor.processResultSet(java.sql.Statement, int, int, int),
AbstractQueryExecutor.processUpdateCount(java.sql.Statement)
getTotalRows
public int getTotalRows(String sql)
throws SQLException
- Return the total number of rows that can be retrieved by executing the
specified SQL statement.
- Parameters:
sql - The statement to be executed.
- Returns:
- The total number of rows that are available in the database.
- Throws:
SQLException - If errors are encountered while executing the
statement.