Class com.ibm.ivj.db.uibeans.Statement
java.lang.Object
|
+----com.ibm.ivj.db.uibeans.Statement
- public abstract class Statement
- implements Serializable, DatabaseConnectionAfterListener, DatabaseConnectionBeforeListener, StatementAfterListener, StatementBeforeListener, PropertyChangeListener
- extends Object
Statement is the abstract super class for data access beans. Data access beans
allow you to access data in a relational database using JDBC.
- See Also:
- Select
- ProcedureCall
Constructor Index
- Statement()
- Constructs a new Statement.
Method Index
- aboutToClose(DataEvent)
- Invoked when the underlying com.ibm.db.StatementResultBefore event
aboutToClose
fires, and fires the corresponding DataBefore event
aboutToClose
.
- aboutToCommit(DataEvent)
- Invoked when the underlying com.ibm.db.DatabaseConnectionBefore event
aboutToCommit
fires and fires the corresponding DataBefore event
aboutToCommit
.
- aboutToConnect(DataEvent)
- Invoked when the underlying com.ibm.db.DatabaseConnectionBefore event
aboutToConnect
fires, and fires the corresponding DataBefore event
aboutToConnect
.
- aboutToDisconnect(DataEvent)
- Invoked when the underlying com.ibm.db.DatabaseConnectionBefore event
aboutToDisconnect
fires, and fires the corresponding DataBefore event
aboutToDisconnect
.
- aboutToExecute(DataEvent)
- Invoked when the underlying com.ibm.db.StatementBefore event
aboutToExecute
fires, and fires the corresponding DataBefore event
aboutToExecute
.
- aboutToRollback(DataEvent)
- Invoked when the underlying com.ibm.db.DatabaseConnectionBefore event
aboutToRollback
fires, and fires the corresponding DataBefore event
aboutToRollback
.
- addDataAfterListener(DataAfterListener)
- Adds a listener to the DataAfter event set.
- addDataBeforeListener(DataBeforeListener)
- Adds a listener to the DataBefore event set.
- addPropertyChangeListener(PropertyChangeListener)
- Adds a listener to the PropertyChange event set.
- cacheResultsChanged(DataEvent)
- Invoked when the underlying com.ibm.db.StatementAfter event
cacheResultsChanged
fires, and fires the corresponding DataAfter event
cacheResultsChanged
.
- cancelAction()
- Cancels execution of the SQL statement performing the current action.
- closed(DataEvent)
- Invoked when the underlying com.ibm.db.StatementResultAfter event
closed
fires, and fires the corresponding DataAfter event
closed
.
- committed(DataEvent)
- Invoked when the underlying com.ibm.db.DatabaseConnectionAfter event
commmitted
fires and fires the corresponding DataAfter event
committed
.
- connected(DataEvent)
- Invoked when the underlying com.ibm.db.DatabaseConnectionAfter event
connected
fires, and fires the corresponding DataAfter event
connected
.
- disconnected(DataEvent)
- Invoked when the underlying com.ibm.db.DatabaseConnectionAfter event
disconnected
fires, and fires the corresponding DataAfter event
disconnected
.
- execute()
- Executes the SQL statement.
- executed(DataEvent)
- Invoked when the underlying com.ibm.db.StatementAfter event
executed
fires, and fires the corresponding DataAfter event
executed
.
- getDatabaseConnection()
- Returns the associated com.ibm.db.DatabaseConnection that contains the specifications
for the connection.
- getParameter(int)
- Returns the value of the parameter at the specified index.
- getParameter(String)
- Returns the value of the parameter with the specified name.
- getParameterToString(int)
- Returns the value of the parameter at the specified index as a String.
- getParameterToString(String)
- Returns the value of the parameter with the specified name as a String.
- getStatementMetaData()
- Returns the underlying com.ibm.db.StatementMetaData.
- getTimeout()
- Returns the number of seconds the JDBC driver will wait for this statement
to execute.
- isConnected()
- Returns true if the connection to the database is open.
- removeDataAfterListener(DataAfterListener)
- Removes a listener to the DataAfter event set.
- removeDataBeforeListener(DataBeforeListener)
- Removes a listener to the DataBefore event set.
- removePropertyChangeListener(PropertyChangeListener)
- Removes a listener to the PropertyChange event set.
- rolledBack(DataEvent)
- Invoked when the underlying com.ibm.db.DatabaseConnectionAfter event
rolledBack
fires, and fires the corresponding DataAfter event
rolledBack
.
- setDatabaseConnection(DatabaseConnection)
- Associates a com.ibm.db.DatabaseConnection with this Statement.
- setParameter(int, Object)
- Sets the parameter at the specified index to the specified value.
- setParameter(String, Object)
- Sets the parameter with the specified name to the specified value.
- setParameterFromString(int, String)
- Sets the parameter at the specified index to the specified value.
- setParameterFromString(String, String)
- Sets the parameter with the specified name to the specified value.
- setStatementMetaData(StatementMetaData)
- Associates a StatementMetaData with this Statement.
- setTimeout(int)
- Sets the number of seconds the JDBC driver will wait for this statement
to execute.
Constructors
Statement
public Statement()
- Constructs a new Statement.
Methods
aboutToClose
public void aboutToClose(DataEvent event)
- Invoked when the underlying com.ibm.db.StatementResultBefore event
aboutToClose
fires, and fires the corresponding DataBefore event
aboutToClose
.
- Parameters:
- event - DataEvent
aboutToCommit
public void aboutToCommit(DataEvent event)
- Invoked when the underlying com.ibm.db.DatabaseConnectionBefore event
aboutToCommit
fires and fires the corresponding DataBefore event
aboutToCommit
.
- Parameters:
- event - DataEvent
aboutToConnect
public void aboutToConnect(DataEvent event)
- Invoked when the underlying com.ibm.db.DatabaseConnectionBefore event
aboutToConnect
fires, and fires the corresponding DataBefore event
aboutToConnect
.
- Parameters:
- event - DataEvent
aboutToDisconnect
public void aboutToDisconnect(DataEvent event)
- Invoked when the underlying com.ibm.db.DatabaseConnectionBefore event
aboutToDisconnect
fires, and fires the corresponding DataBefore event
aboutToDisconnect
.
- Parameters:
- event - DataEvent
aboutToExecute
public void aboutToExecute(DataEvent event)
- Invoked when the underlying com.ibm.db.StatementBefore event
aboutToExecute
fires, and fires the corresponding DataBefore event
aboutToExecute
.
- Parameters:
- event - DataEvent
aboutToRollback
public void aboutToRollback(DataEvent event)
- Invoked when the underlying com.ibm.db.DatabaseConnectionBefore event
aboutToRollback
fires, and fires the corresponding DataBefore event
aboutToRollback
.
- Parameters:
- event - DataEvent
addDataAfterListener
public void addDataAfterListener(DataAfterListener listener)
- Adds a listener to the DataAfter event set. DataAfter events occur after
actions have been completed.
- Parameters:
- listener - DataAfterListener
- See Also:
- DataAfterListener
- removeDataAfterListener
addDataBeforeListener
public void addDataBeforeListener(DataBeforeListener listener)
- Adds a listener to the DataBefore event set. DataBefore events occur after
actions have been completed.
- Parameters:
- listener - DataBeforeListener
- See Also:
- DataBeforeListener
- removeDataBeforeListener
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener to the PropertyChange event set.
- Parameters:
- listener - PropertyChangeListener
- See Also:
- removePropertyChangeListener
cacheResultsChanged
public void cacheResultsChanged(DataEvent event)
- Invoked when the underlying com.ibm.db.StatementAfter event
cacheResultsChanged
fires, and fires the corresponding DataAfter event
cacheResultsChanged
.
- Parameters:
- event - DataEvent
cancelAction
public abstract void cancelAction() throws DataException
- Cancels execution of the SQL statement performing the current action.
In order to use this method, it must be invoked from a thread different
from the one in which the SQL statement is running. See subclasses for
implementation details.
- Throws: DataException
- - if an error occurs
closed
public void closed(DataEvent event)
- Invoked when the underlying com.ibm.db.StatementResultAfter event
closed
fires, and fires the corresponding DataAfter event
closed
.
- Parameters:
- event - DataEvent
committed
public void committed(DataEvent event)
- Invoked when the underlying com.ibm.db.DatabaseConnectionAfter event
commmitted
fires and fires the corresponding DataAfter event
committed
.
- Parameters:
- event - DataEvent
connected
public void connected(DataEvent event)
- Invoked when the underlying com.ibm.db.DatabaseConnectionAfter event
connected
fires, and fires the corresponding DataAfter event
connected
.
- Parameters:
- event - DataEvent
disconnected
public void disconnected(DataEvent event)
- Invoked when the underlying com.ibm.db.DatabaseConnectionAfter event
disconnected
fires, and fires the corresponding DataAfter event
disconnected
.
- Parameters:
- event - DataEvent
execute
public abstract void execute() throws DataException
- Executes the SQL statement. See subclasses for implementation.
- Throws: DataException
- - if an error occurs
executed
public void executed(DataEvent event)
- Invoked when the underlying com.ibm.db.StatementAfter event
executed
fires, and fires the corresponding DataAfter event
executed
.
- Parameters:
- event - DataEvent
getDatabaseConnection
public DatabaseConnection getDatabaseConnection()
- Returns the associated com.ibm.db.DatabaseConnection that contains the specifications
for the connection.
- Returns:
- the associated DatabaseConnection
- See Also:
- setDatabaseConnection
- DatabaseConnection
getParameter
public abstract Object getParameter(int parameterNumber) throws DataException
- Returns the value of the parameter at the specified index.
The index of the first parameter is 1. See subclasses for
implementation details.
- Parameters:
- parameterNumber - index of the parameter
- Returns:
- the parameter value
- Throws: IndexOutOfBoundsException
- if the parameter index is not
defined
- Throws: DataException
- - if an error occurs
- See Also:
- setParameter
getParameter
public abstract Object getParameter(String parameterName) throws DataException
- Returns the value of the parameter with the specified name. See subclasses for
implementation details.
- Parameters:
- parameterName - name of the parameter
- Returns:
- the parameter value
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- Throws: DataException
- - if an error occurs
- See Also:
- setParameter
getParameterToString
public abstract String getParameterToString(int parameterNumber) throws DataException
- Returns the value of the parameter at the specified index as a String. The value
of the parameter is converted to a String before the value is returned. If the
parameter value is null, a null is returned.
The index of the first parameter is 1. See subclasses for
implementation details.
- Parameters:
- parameterNumber - index of the parameter
- Returns:
- value of the parameter as a String
- Throws: IndexOutOfBoundsException
- if the parameter index is not
defined
- Throws: DataException
- - if an error occurs
- See Also:
- setParameterFromString
getParameterToString
public abstract String getParameterToString(String parameterName) throws DataException
- Returns the value of the parameter with the specified name as a String. The value
of the parameter is converted to a String before the value is returned. If the
parameter value is null, a null is returned. See subclasses for
implementation details.
- Parameters:
- parameterName - name of the parameter
- Returns:
- value of the parameter as a String
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- Throws: DataException
- - if an error occurs
- See Also:
- setParameterFromString
getStatementMetaData
public abstract StatementMetaData getStatementMetaData()
- Returns the underlying com.ibm.db.StatementMetaData.
- Returns:
- the associated StatementMetaData
- See Also:
- setStatementMetaData
getTimeout
public abstract int getTimeout()
- Returns the number of seconds the JDBC driver will wait for this statement
to execute. If the limit is exceeded, a DataException is thrown by the
execute method.
- Returns:
- the timeout limit in seconds; zero means unlimited
- See Also:
- setTimeout
isConnected
public boolean isConnected() throws DataException
- Returns true if the connection to the database is open.
- Returns:
- true if the connection to the database is open
- Throws: DataException
- sqlException
- if an SQL exception occurs
removeDataAfterListener
public void removeDataAfterListener(DataAfterListener listener)
- Removes a listener to the DataAfter event set. DataAfter events occur after
actions have been completed.
- Parameters:
- listener - DataAfterListener
- See Also:
- DataAfterListener
- addDataAfterListener
removeDataBeforeListener
public void removeDataBeforeListener(DataBeforeListener listener)
- Removes a listener to the DataBefore event set. DataBefore events occur after
actions have been completed.
- Parameters:
- listener - DataBeforeListener
- See Also:
- DataBeforeListener
- addDataBeforeListener
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a listener to the PropertyChange event set.
- Parameters:
- listener - PropertyChangeListener
- See Also:
- addPropertyChangeListener
rolledBack
public void rolledBack(DataEvent event)
- Invoked when the underlying com.ibm.db.DatabaseConnectionAfter event
rolledBack
fires, and fires the corresponding DataAfter event
rolledBack
.
- Parameters:
- event - DataEvent
setDatabaseConnection
public void setDatabaseConnection(DatabaseConnection connection)
- Associates a com.ibm.db.DatabaseConnection with this Statement.
- Parameters:
- connection - the associated DatabaseConnection
- See Also:
- getDatabaseConnection
- DatabaseConnection
setParameter
public abstract void setParameter(int parameterNumber,
Object aValue) throws DataException
- Sets the parameter at the specified index to the specified value.
The index of the first parameter is 1.
- Parameters:
- parameterNumber - index of the parameter
- aValue - parameter value
- Throws: IndexOutOfBoundsException
- if the parameter index is not
defined
- Throws: DataException
- if the value does match the object type
of the parameter
- See Also:
- getParameter
setParameter
public abstract void setParameter(String parameterName,
Object aValue) throws DataException
- Sets the parameter with the specified name to the specified value.
- Parameters:
- parameterName - name of the parameter
- aValue - parameter value
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- Throws: DataException
- if the value does match the object type
of the parameter
- See Also:
- getParameter
setParameterFromString
public abstract void setParameterFromString(int parameterNumber,
String stringValue) throws DataException
- Sets the parameter at the specified index to the specified value.
The index of the first parameter is 1.
The stringValue is converted to the datatype associated with the parameter before the
parameter is updated. If the datatype for the parameter is not String and
the stringValue is a zero-length String, the parameter will be set to NULL.
- Parameters:
- parameterNumber - index of the parameter
- stringValue - parameter value as a String
- Throws: IndexOutOfBoundsException
- if the parameter index is not
defined
- Throws: DataException
- if the value does match the object type
of the parameter
- See Also:
- getParameterToString
setParameterFromString
public abstract void setParameterFromString(String parameterName,
String stringValue) throws DataException
- Sets the parameter with the specified name to the specified value.
The index of the first parameter is 1.
The stringValue is converted to the datatype associated with the parameter before the
parameter is updated. If the datatype for the parameter is not String and
the stringValue is a zero-length String, the parameter will be set to NULL.
- Parameters:
- parameterName - name of the parameter
- stringValue - parameter value as a String
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- Throws: DataException
- if the value does match the object type
of the parameter
- See Also:
- getParameterToString
setStatementMetaData
public abstract void setStatementMetaData(StatementMetaData metaData)
- Associates a StatementMetaData with this Statement.
- Parameters:
- metaData - the associated StatementMetaData
- See Also:
- getStatementMetaData
setTimeout
public abstract void setTimeout(int seconds)
- Sets the number of seconds the JDBC driver will wait for this statement
to execute. If the limit is exceeded, a DataException is thrown by the
execute method.
- Parameters:
- seconds - the new timeout limit in seconds; zero means unlimited
- See Also:
- getTimeout
