All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.samples.daps.sql.Select

java.lang.Object
   |
   +----com.ibm.beans.samples.daps.sql.Common
           |
           +----com.ibm.beans.samples.daps.sql.Statement
                   |
                   +----com.ibm.beans.samples.daps.sql.DML
                           |
                           +----com.ibm.beans.samples.daps.sql.Select

public class Select
extends DML
The Select class is instantiated to represent a single SQL Select statement.

This class supports cursoring through the Select statement's result set.

To use the Select bean, do the following:

  1. Create an instance of the bean.
  2. Fill in the bean's properties (described below or in superclass):
  3. Bind an existing Connection bean's JDBCConnection property to this bean's JDBCConnection property. This will cause execution of the connect() method on the Connection bean to also set the JDBCConnection property on this bean.
  4. If parameter markers are used in the SQL statement, set up the inputs parameter. Each item in the Vector will correspond to the similarly-ordered parameter marker.
  5. Bind the resultRow property to an existing Viewer bean's additionalRow property. This will cause the output values to be displayed as they are retrieved from the database.
  6. Use the execute() method to execute the statement. The execute() method uses all the above properties to perform execution of the Select statement. The execute() method sets values and fires property change events for the following properties on completion:
  7. Repeatedly use the next() method to get the resulting rows of the Select. The next() method sets values and fires property change events for the following properties on completion:
  8. Use the close() method to relinquish the statement's resources. The close() method sets values and fires property change events for the following properties on completion:

See Also:
Viewer, SelectBeanInfo

Variable Index

 o columnLengths
A Vector of Integers representing the columns lengths of this Select.
 o columnNames
A Vector of Strings representing the columns last of this Select.
 o columnNullables
A Vector of Integers representing the columns nullable characteristics of this Select.
 o columnTypes
A Vector of Strings representing the columns types of this Select.
 o maxFieldSizeReturned
Maximum size of a single field in a returned row.
 o maxRowsReturned
Maximum number of rows that can be returned by a Select statement.
 o md
The query's result set's meta data.
 o NEXT
Background thread fetching next row for SQL Select statement.
 o resultRow
A Vector of objects representing the last result row found.
 o rowFound
Whether a row has been found or not.
 o rs
The query's result set.

Constructor Index

 o Select()
Default constructor.

Method Index

 o closeBackground()
The actual background thread code that executes the close operation.
 o finalize()
Finalize this object.
 o getColumnLengths()
Get the last Vector containing the columns' lengths.
 o getColumnNames()
Get the last Vector containing the columns' names.
 o getColumnNullables()
Get the last Vector containing the columns' nulllables.
 o getColumnTypes()
Get the last Vector containing the columns' types.
 o getMaxFieldSizeReturned()
Get the maximum size of a single field that can be returned in a row.
 o getMaxRowsReturned()
Get the maximum number of rows that can be returned.
 o getResultRow()
Get the last result row Vector.
 o getRowFound()
Get a boolean that signifies whether an additional row was found or not.
 o handleResultMetaData()
Method to handle result meta data for an SQL statement.
 o next()
Method to retrieve the next row of an SQL result set.
 o nextBackground()
The actual background thread code that executes the close operation.
 o performWork()
Call method based on the background task to be performed.
 o prepareStatement()
Method to prepare SQL statement and rethrow any exceptions.
 o setColumnLengths(Vector)
Set the last Vector containing the columns' lengths.
 o setColumnNames(Vector)
Set the last Vector containing the columns' names.
 o setColumnNullables(Vector)
Set the last Vector containing the columns' nullables.
 o setColumnTypes(Vector)
Set the last Vector containing the columns' types.
 o setMaxFieldSizeReturned(int)
Set the maximum size of a single field that can be returned in a row.
 o setMaxRowsReturned(int)
Set the maximum number of rows that can be returned.
 o setResultRow(Vector)
Set the last result row vector.
 o setRowFound(boolean)
Set a boolean that signifies whether an additional row was found or not.

Variables

 o maxRowsReturned
 protected int maxRowsReturned
Maximum number of rows that can be returned by a Select statement.

This field is used by the prepareStatement() method.

This field must be set prior to execution of the execute() method.

 o maxFieldSizeReturned
 protected int maxFieldSizeReturned
Maximum size of a single field in a returned row.

This field is used by the prepareStatement() method.

This field must be set prior to execution of the execute() method.

 o columnNames
 protected transient Vector columnNames
A Vector of Strings representing the columns last of this Select.

This field is set by the handleResultMetaData() method.

 o columnTypes
 protected transient Vector columnTypes
A Vector of Strings representing the columns types of this Select.

This field is set by the handleResultMetaData() method.

 o columnLengths
 protected transient Vector columnLengths
A Vector of Integers representing the columns lengths of this Select.

This field is set by the handleResultMetaData() method.

 o columnNullables
 protected transient Vector columnNullables
A Vector of Integers representing the columns nullable characteristics of this Select. Possible individual values are

This field is set by the handleResultMetaData() method.

 o rowFound
 protected transient boolean rowFound
Whether a row has been found or not.

This field is set by the nextBackground() method.

 o resultRow
 protected transient Vector resultRow
A Vector of objects representing the last result row found.

This field is set by the nextBackground() method.

 o rs
 protected transient ResultSet rs
The query's result set.

This is only used internally.

 o md
 protected transient ResultSetMetaData md
The query's result set's meta data.

This is only used internally.

 o NEXT
 protected static final transient int NEXT
Background thread fetching next row for SQL Select statement.

Constructors

 o Select
 public Select()
Default constructor.

Methods

 o finalize
 protected void finalize() throws Throwable
Finalize this object.

Throws: Throwable
Possibly thrown by the superclass.
Overrides:
finalize in class DML
 o getMaxRowsReturned
 public int getMaxRowsReturned()
Get the maximum number of rows that can be returned.

Returns:
The maximum number of rows that the SQL Select statement can return.
 o setMaxRowsReturned
 public synchronized void setMaxRowsReturned(int maxRowsReturned)
Set the maximum number of rows that can be returned.

This value is used by the prepareStatement() method.

Fire the property change event for the maxRowsReturned integer.

Parameters:
maxRowsReturned - The maximum number of rows that the SQL Select statement can return.
 o getMaxFieldSizeReturned
 public int getMaxFieldSizeReturned()
Get the maximum size of a single field that can be returned in a row.

Returns:
The maximum size of a single field that can be returned in a row.
 o setMaxFieldSizeReturned
 public synchronized void setMaxFieldSizeReturned(int maxFieldSizeReturned)
Set the maximum size of a single field that can be returned in a row.

This value is used by the prepareStatement() method.

Fire the property change event for the maxFieldSizeReturned integer.

Parameters:
maxFieldSizeReturned - The maximum size of a single field that can be returned in a row.
 o getColumnNames
 public Vector getColumnNames()
Get the last Vector containing the columns' names.

Returns:
The last Vector containing the columns' names.
 o setColumnNames
 protected void setColumnNames(Vector columnNames)
Set the last Vector containing the columns' names.

This method can only be called internally via the handleResultMetaData() method.

Fire the property change event for the columnNames Vector.

Parameters:
columnNames - The last Vector containing the columns' names.
 o getColumnTypes
 public Vector getColumnTypes()
Get the last Vector containing the columns' types.

Returns:
The last Vector containing the columns' types.
 o setColumnTypes
 protected void setColumnTypes(Vector columnTypes)
Set the last Vector containing the columns' types.

This method can only be called internally via the handleResultMetaData() method.

Fire the property change event for the columnTypes Vector.

Parameters:
columnTypes - The last Vector containing the columns' types.
 o getColumnLengths
 public Vector getColumnLengths()
Get the last Vector containing the columns' lengths.

Returns:
The last Vector containing the columns' lengths.
 o setColumnLengths
 protected void setColumnLengths(Vector columnLengths)
Set the last Vector containing the columns' lengths.

This method can only be called internally via the handleResultMetaData() method.

Fire the property change event for the columnLengths Vector.

Parameters:
columnLengths - The last Vector containing the columns' lengths.
 o getColumnNullables
 public Vector getColumnNullables()
Get the last Vector containing the columns' nulllables.

Returns:
The last Vector containing the columns' nullables.
 o setColumnNullables
 protected void setColumnNullables(Vector columnNullables)
Set the last Vector containing the columns' nullables.

This method can only be called internally via the handleResultMetaData() method.

Fire the property change event for the columnNullables Vector.

Parameters:
columnNullables - The last Vector containing the columns' nullables.
 o getResultRow
 public Vector getResultRow()
Get the last result row Vector.

Returns:
The last result row Vector.
 o setResultRow
 protected void setResultRow(Vector resultRow)
Set the last result row vector.

This method can only be called internally via the nextBackground() method.

Fire the property change event for the resultRow Vector.

Parameters:
resultRow - A Vector of objects representing the last result row.
 o getRowFound
 public boolean getRowFound()
Get a boolean that signifies whether an additional row was found or not.

Returns:
Whether an additional row was found or not.
 o setRowFound
 protected void setRowFound(boolean rowFound)
Set a boolean that signifies whether an additional row was found or not.

This method can only be called internally via the nextBackground() method.

Fire the property change event for the rowFound boolean.

Parameters:
rowFound - Whether an additional row was found or not.
 o prepareStatement
 protected void prepareStatement() throws SQLException
Method to prepare SQL statement and rethrow any exceptions.

The maxRowsReturned and maxFieldSizeReturned properties are used by this method.

Throws: SQLException
Thrown setting maximum rows or field size.
Overrides:
prepareStatement in class Statement
 o handleResultMetaData
 protected void handleResultMetaData() throws SQLException
Method to handle result meta data for an SQL statement.

The columnNames, columnTypes, columnLengths and columnNullables Vectors are set by this method.

Throws: SQLException
Thrown by the superclass or by retrieving the column information from the resultSet's metadata.
Overrides:
handleResultMetaData in class Statement
 o next
 public synchronized void next()
Method to retrieve the next row of an SQL result set.

The exception, successful, rowFound and resultRow properties are indirectly set by this method.

See Also:
nextBackground
 o nextBackground
 protected void nextBackground() throws SQLException, NullPointerException
The actual background thread code that executes the close operation.

The rowFound and resultRow properties are set by this method.

Throws: SQLException
SQL Exception
Throws: NullPointerException
Pointer not set
 o closeBackground
 protected void closeBackground() throws SQLException, NullPointerException
The actual background thread code that executes the close operation.

The columnNames, columnTypes, columnLengths, columnNullables, resultRow and rowFound properties are set by this method.

Throws: SQLException
SQL Exception
Throws: NullPointerException
Pointer not set
Overrides:
closeBackground in class DML
 o performWork
 protected void performWork() throws SQLException, NullPointerException
Call method based on the background task to be performed. The caller has guaranteed this will NOT be called for the INITIAL task.

Throws: SQLException
SQL Exception
Throws: NullPointerException
Pointer not set
Overrides:
performWork in class Statement

All Packages  Class Hierarchy  This Package  Previous  Next  Index