Where Am I? Class Hierarchy All Classes All Fields and Methods

Class com.ibm.db.SelectStatement

java.lang.Object
   |
   +----com.ibm.db.Statement
           |
           +----com.ibm.db.SelectStatement

public class SelectStatement
extends Statement

SelectStatement represents a SQL Select statement.

Version:
1.0 06/30/98
See Also:
Statement

Constructor Index

SelectStatement()
Constructs a new SelectStatement.

Method Index

execute()
Executes the SQL SELECT statement and positions to the first row in the result set.
getMaximumPacketsInCache()
Returns the maximum number of packets the cache can contain.
getMaximumRows()
Returns the maximum size of the result set.
getPacketSize()
Returns the number of rows that are in one packet in the cache.
getResult()
Returns the SelectResult that is associated with this SelectStatement.
isFillCacheOnExecute()
Returns true if the entire cache will be filled when execute is invoked.
isLockRows()
Returns true if a database lock is automatically held on a row while it is the current row in the associated Select Result.
refresh()
Refreshes the result set from the database by re-executing the SQL SELECT statement.
setFillCacheOnExecute(boolean)
If true, the entire cache will be filled when execute is invoked.
setLockRows(boolean)
If true, a database lock is automatically held on a row while it is the current row in the associated Select Result.
setMaximumPacketsInCache(int)
Sets the maximum number of packets the cache can contain.
setMaximumRows(int)
Sets the maximum size of the result set.
setPacketSize(int)
Sets the number of rows that are in one packet in the cache.

Constructors

SelectStatement
 public SelectStatement()
Constructs a new SelectStatement.


Methods

execute
 public void execute() throws DataException
Executes the SQL SELECT statement and positions to the first row in the result set. If needed, a connection is made to the database prior to executing the SQL statement, using the associated DatabaseConnection. The SQL statement is obtained from the StatementMetaData associated with this SelectStatement. The result set can be accessed through the SelectResult associated with this SelectStatement.

The events aboutToExecute and executed are triggered by this method.

The event cacheRowsChanged of the associated SelectResult is triggered by this method.

Throws: DataException
noConnection - if no associated DatabaseConnection
Throws: DataException
noGui - if no GUI available and logon prompt requested
Throws: DataException
badUidPwd - if incorrect Userid or password specified
Throws: DataException
noSQL - if SQL statement is null
Throws: DataException
notSelect - if SQL statement is not a SELECT statement
Throws: DataException
sqlException - if a SQLException occurred
Overrides:
execute in class Statement
See Also:
DatabaseConnection, StatementMetaData, SelectResult
getMaximumPacketsInCache
 public int getMaximumPacketsInCache()
Returns the maximum number of packets the cache can contain.

Returns:
the maximum number of packets in the cache
See Also:
setMaximumPacketsInCache
getMaximumRows
 public int getMaximumRows()
Returns the maximum size of the result set. If there is no limit to the size of the result set, the value will be 0.

Returns:
the maximum size of the result set.
See Also:
setMaximumRows
getPacketSize
 public int getPacketSize()
Returns the number of rows that are in one packet in the cache.

Returns:
the size of the packet in the cache.
See Also:
setPacketSize
getResult
 public SelectResult getResult()
Returns the SelectResult that is associated with this SelectStatement. The user can access the result set from executing the SQL statement through the SelectResult.

Returns:
the associated SelectResult
isFillCacheOnExecute
 public boolean isFillCacheOnExecute()
Returns true if the entire cache will be filled when execute is invoked.

Returns:
true if the entire cache will be filled when execute is invoked, else false.
See Also:
setFillCacheOnExecute
isLockRows
 public boolean isLockRows()
Returns true if a database lock is automatically held on a row while it is the current row in the associated Select Result. Returns false if a database lock is only held on a row while it is being updated in the database.

See the lockRow method of SelectResult for a fuller discussion of what it means for a row to be locked.

Returns:
The lockRows property value.
See Also:
setLockRows, lockRow
refresh
 public void refresh() throws DataException
Refreshes the result set from the database by re-executing the SQL SELECT statement. The statement must currently be open.

The event cacheRowsChanged of the associated SelectResult is triggered by this method.

Throws: DataException
noActiveConnection - if no active connection exists
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
sqlException - if a SQLException occurred
See Also:
execute
setFillCacheOnExecute
 public void setFillCacheOnExecute(boolean fillCacheOnExecute)
If true, the entire cache will be filled when execute is invoked. Otherwise, rows will be fetched into the cache as needed to satisfy a request to set the current row position.

The default value is true.

Parameters:
fillCacheOnExecute - true, fill entire cache on execute ; false fill cache only as needed
See Also:
getFillCacheOnExecute
setLockRows
 public void setLockRows(boolean lockRows)
If true, a database lock is automatically held on a row while it is the current row in the associated Select Result. If false, a database lock is only held on a row while it is being updated in the database.

The default value is false.

See the lockRow method of SelectResult for a fuller discussion of what it means for a row to be locked.

Parameters:
lockRows - true, hold database lock while a row is the current row; false hold database lock only while a row is updated.
See Also:
getLockRows, lockRow
setMaximumPacketsInCache
 public void setMaximumPacketsInCache(int maximumPacketsInCache)
Sets the maximum number of packets the cache can contain. Set the value to 0 if there is no limit on the number of packets in the cache.

The default value is 0.

Parameters:
maximumPacketsInCache - the maximum number of packets in cache
See Also:
getMaximumPacketsInCache
setMaximumRows
 public void setMaximumRows(int maximumRows)
Sets the maximum size of the result set. Set the value to 0 if there is no limit on the number of rows that can be contained in the result set.

The default value is 0.

Parameters:
maximumRows - the maximum number of rows in the result set
See Also:
getMaximumRows
setPacketSize
 public void setPacketSize(int packetSize)
Sets the number of rows that are in one packet in the cache. Set the value to 0 if there is no limit on the number of rows in a packet.

The default value is 0.

Parameters:
packetSize - the size of the packet in the cache
See Also:
getPacketSize

Where Am I? Class Hierarchy All Classes All Fields and Methods