SPT RWT Application API

com.sptci.rwt
Class AbstractQueryExecutor

java.lang.Object
  extended by com.sptci.rwt.AbstractQueryExecutor
Direct Known Subclasses:
BatchQueryExecutor, QueryExecutor

public abstract class AbstractQueryExecutor
extends Object

A utility class to execute SQL statement (only one statement allowed).

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: AbstractQueryExecutor.java 4123 2008-05-25 21:49:01Z rakesh $
Author:
Rakesh Vidyadharan 2007-10-01
See Also:
BatchQueryExecutor

Field Summary
protected  ConnectionManager manager
          The manager to use to fetch database connections.
 
Constructor Summary
protected AbstractQueryExecutor(ConnectionManager manager)
          Create a new instance using the specified manager to fetch connections.
 
Method Summary
protected  Statement createStatement(Connection connection)
          Create a Statement for the specified SQL statement(s) and return it.
protected  String getClobValue(Clob clob, int length)
          Return the value that is to be displayed for a Clob type.
protected  Rows processResultSet(Statement statement, int page, int rowsPerPage, int maxColumnLength)
          Create a Rows object that represent the rows in the result set within the specified row range.
protected  String processText(String text, int length)
          Return the value that is to be displayed for a text value.
protected  Rows processUpdateCount(Statement statement)
          Return a Rows object that represents the updateCount obtained by executing a Statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

protected final ConnectionManager manager
The manager to use to fetch database connections.

Constructor Detail

AbstractQueryExecutor

protected AbstractQueryExecutor(ConnectionManager manager)
Create a new instance using the specified manager to fetch connections.

Parameters:
manager - The connection manager to use.
Method Detail

createStatement

protected Statement createStatement(Connection connection)
                             throws SQLException
Create a Statement for the specified SQL statement(s) and return it.

Parameters:
connection - The database connection to use.
Throws:
SQLException - If errors are encountered while creating the statement.

processResultSet

protected Rows processResultSet(Statement statement,
                                int page,
                                int rowsPerPage,
                                int maxColumnLength)
                         throws SQLException
Create a Rows object that represent the rows in the result set within the specified row range.

Parameters:
statement - The statement whose result set to process.
page - The page number being retrieved. Page number is specified using zero based indexing as opposed to 1 based.
rowsPerPage - The number of rows to display per page.
maxColumnLength - The maximum number of characters to retrieve from CLOB type columns to avoid memory issues.
Throws:
SQLException - If errors are encountered while executing the statement(s) and fetching the results.
See Also:
getClobValue(java.sql.Clob, int)

processUpdateCount

protected Rows processUpdateCount(Statement statement)
                           throws SQLException
Return a Rows object that represents the updateCount obtained by executing a Statement.

Parameters:
statement - The statement from which update count is to be retrieved.
Returns:
The rows object representing the update count.
Throws:
SQLException - If errors are encountered while fetching the update count from statement.

getClobValue

protected String getClobValue(Clob clob,
                              int length)
                       throws SQLException
Return the value that is to be displayed for a Clob type.

Parameters:
clob - The CLOB whose content is to be retrieved.
length - The maximum number of characters to display.
Throws:
SQLException - If errors are encountered while fetching the content of the CLOB.
Since:
Version 1.3

processText

protected String processText(String text,
                             int length)
Return the value that is to be displayed for a text value. Strips any invalid XML characters and truncates if necessary.

Parameters:
text - The text content that is to be processed.
length - The maximum number of characters to display
Since:
Version 1.3

SPT RWT Application API