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:
- Create an instance of the bean.
- Fill in the bean's properties (described below or in superclass):
- executeInBackground
- inputs
- maxRowsReturned
- maxFieldSizeReturned
- SQLText
- 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.
- 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.
- 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.
- 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:
- columnNames
- columnLengths
- columnNullables
- columnTypes
- exception
- successful
- 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:
- exception
- resultRow
- rowFound
- successful
- 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:
- columnNames
- columnLengths
- columnNullables
- columnTypes
- exception
- resultRow
- rowFound
- successful
- See Also:
- Viewer, SelectBeanInfo
-
columnLengths
- A Vector of Integers representing the columns lengths of this Select.
-
columnNames
- A Vector of Strings representing the columns last of this Select.
-
columnNullables
- A Vector of Integers representing the columns nullable characteristics
of this Select.
-
columnTypes
- A Vector of Strings representing the columns types of this Select.
-
maxFieldSizeReturned
- Maximum size of a single field in a returned row.
-
maxRowsReturned
- Maximum number of rows that can be returned by a Select statement.
-
md
- The query's result set's meta data.
-
NEXT
- Background thread fetching next row for SQL Select statement.
-
resultRow
- A Vector of objects representing the last result row found.
-
rowFound
- Whether a row has been found or not.
-
rs
- The query's result set.
-
Select()
- Default constructor.
-
closeBackground()
- The actual background thread code that executes the close operation.
-
finalize()
- Finalize this object.
-
getColumnLengths()
- Get the last Vector containing the columns' lengths.
-
getColumnNames()
- Get the last Vector containing the columns' names.
-
getColumnNullables()
- Get the last Vector containing the columns' nulllables.
-
getColumnTypes()
- Get the last Vector containing the columns' types.
-
getMaxFieldSizeReturned()
- Get the maximum size of a single field that can be returned in a row.
-
getMaxRowsReturned()
- Get the maximum number of rows that can be returned.
-
getResultRow()
- Get the last result row Vector.
-
getRowFound()
- Get a boolean that signifies whether an additional row was found or not.
-
handleResultMetaData()
- Method to handle result meta data for an SQL statement.
-
next()
- Method to retrieve the next row of an SQL result set.
-
nextBackground()
- The actual background thread code that executes the close operation.
-
performWork()
- Call method based on the background task to be performed.
-
prepareStatement()
- Method to prepare SQL statement and rethrow any exceptions.
-
setColumnLengths(Vector)
- Set the last Vector containing the columns' lengths.
-
setColumnNames(Vector)
- Set the last Vector containing the columns' names.
-
setColumnNullables(Vector)
- Set the last Vector containing the columns' nullables.
-
setColumnTypes(Vector)
- Set the last Vector containing the columns' types.
-
setMaxFieldSizeReturned(int)
- Set the maximum size of a single field that can be returned in a row.
-
setMaxRowsReturned(int)
- Set the maximum number of rows that can be returned.
-
setResultRow(Vector)
- Set the last result row vector.
-
setRowFound(boolean)
- Set a boolean that signifies whether an additional row was found or not.
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.
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.
columnNames
protected transient Vector columnNames
- A Vector of Strings representing the columns last of this Select.
This field is set by the handleResultMetaData() method.
columnTypes
protected transient Vector columnTypes
- A Vector of Strings representing the columns types of this Select.
This field is set by the handleResultMetaData() method.
columnLengths
protected transient Vector columnLengths
- A Vector of Integers representing the columns lengths of this Select.
This field is set by the handleResultMetaData() method.
columnNullables
protected transient Vector columnNullables
- A Vector of Integers representing the columns nullable characteristics
of this Select. Possible individual values are
- java.sql.ResultSetMetaData.columnNoNulls
- java.sql.ResultSetMetaData.columnNullable
- java.sql.ResultSetMetaData.columnNullableUnknown
This field is set by the handleResultMetaData() method.
rowFound
protected transient boolean rowFound
- Whether a row has been found or not.
This field is set by the nextBackground() method.
resultRow
protected transient Vector resultRow
- A Vector of objects representing the last result row found.
This field is set by the nextBackground() method.
rs
protected transient ResultSet rs
- The query's result set.
This is only used internally.
md
protected transient ResultSetMetaData md
- The query's result set's meta data.
This is only used internally.
NEXT
protected static final transient int NEXT
- Background thread fetching next row for SQL Select statement.
Select
public Select()
- Default constructor.
finalize
protected void finalize() throws Throwable
- Finalize this object.
- Throws: Throwable
- Possibly thrown by the superclass.
- Overrides:
- finalize in class DML
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.
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.
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.
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.
getColumnNames
public Vector getColumnNames()
- Get the last Vector containing the columns' names.
- Returns:
- The last Vector containing the columns' names.
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.
getColumnTypes
public Vector getColumnTypes()
- Get the last Vector containing the columns' types.
- Returns:
- The last Vector containing the columns' types.
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.
getColumnLengths
public Vector getColumnLengths()
- Get the last Vector containing the columns' lengths.
- Returns:
- The last Vector containing the columns' lengths.
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.
getColumnNullables
public Vector getColumnNullables()
- Get the last Vector containing the columns' nulllables.
- Returns:
- The last Vector containing the columns' nullables.
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.
getResultRow
public Vector getResultRow()
- Get the last result row Vector.
- Returns:
- The last result row Vector.
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.
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.
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.
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
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
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
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
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
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